[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] determining whether an XPATH points to an element or a
Hi All I have an XPATH that can either point to a element or an attribute. //tagname or //attributename I am using the XPATH to generate template match rules in an XSLT file. If the XPATH points to an attribute I want it to perform one action and if it points to an element I want it to perform another. something like this. <xsl:template match="tagname"> <TagOperation> </xsl:template> <xsl:template match="attributename"> <AttributeOperation> </xsl:template> Is there any way to determine whether the XPATH matches an attribute or element while creating the XSLT file? An alternative idea I had was to include both in the match and check the type of the current node. But there doesn't seem to be any way to test if the current node is an attribute. <xsl:template match="//tagname"> <xsl:choose> <xsl:when test=" current() = some sort of test "><!-- if it points to element --> <TagOperation> </xsl:when> <xsl:otherwise><!-- if it points to attribute--> <AttributeOperation> </xsl:otherwise> </xsl:choose> </xsl:template> Thanks in advance Edward XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|