Subject: RE: [xsl] determining whether an XPATH points to an element or attribute From: Edward.Middleton@xxxxxxxxxxx Date: Thu, 24 Jan 2002 10:22:38 +0900 |
>you can tell if you have an element or an attribute by ><xsl:if test="self::*">which is true just on element nodes Thanks, this is exactly what I want. All I have is a document with arbitrary XPATH's i.e. <path>//tagname1[fads and @fads]/tagname2</path> I am using XSLT to process this file to create a second XSLT file. The second XSLT file has the template in it. <xsl:template match="//tagname1[fads and @fads]/tagname2"> <xsl:choose> <xsl:when test=" self::*"><!-- if it points to element --> <TagOperation> </xsl:when> <xsl:otherwise><!-- if it points to attribute--> <AttributeOperation> </xsl:otherwise> </xsl:choose> </xsl:template> >but this is a rather strange thing to do as 999 times out of 1000 you >always know in a template what kind of node is being matched. Unless I can find out whether the XPATH points to an element or attribute before I create the second XSLT I have to assume it could be either. from Jeni post >But if they're really fairly complicated, with predicates and things, >then you need to write a XPath parser to work out whether they match >elements or attributes. And that's very difficult. I gather there is no simple way to do this with just an XPATH so I will need to test at runtime. Thank a lot for your help Edward XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] determining whether an XP, Jeni Tennison | Thread | Re: [xsl] determining whether an XP, Joerg Heinicke |
[xsl] xslt transform sql into html , Kovach, Dave | Date | Re: [xsl] determining whether an XP, Joerg Heinicke |
Month |