Subject: [xsl] determining whether an XPATH points to an element or attribute From: Edward.Middleton@xxxxxxxxxxx Date: Wed, 23 Jan 2002 17:09:21 +0900 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Output source XML structu, Jarno . Elovirta | Thread | RE: [xsl] determining whether an XP, Edward . Middleton |
RE: [xsl] Output source XML structu, Jarno . Elovirta | Date | RE: [xsl] Output source XML structu, Ilya Khandamirov |
Month |