I have a xml file as below, and now I want to use the XSLT to transformer it, keep all the elements and attributes, but if it happen to the attributes with the value started with "SQL:", then execute the sql and replace the attribute value with the resolved SQL(it involve the http://msdn.microsoft.com/en-us/library/533texsx(VS.90).aspx. now I encoutered the issue:how to check if the current node type is attribute, and how to replace the attribute value, I base on the visual studio default template as below:
the example xml file(there are many elements in real):
<DM>
<DV id="SQL:Select something from db">
<Sample aid="SQL:Select something from db">
</Sample>
</DV>
<DV id="SQL:Select something from db">
<Sample aid="SQL:Select something from db">
</Sample>
</DV>
</DM>
default xslt:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
xmlns:ms="urn:schemas-microsoft-com:xslt" >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>