|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Is this node, the document root... best test?
Thanks Michael and Wendell, etc.,
Okay, so I think i'm getting this now.... So, for any given XML document, (e.g. the fragment below), I want to test, when i'm in the ((match"*" template, mode="xyz")) If, I've "drilled" my way back up to the "document element node"??? Do I have the correct test below? or do I need the: ".. and not(parent::*)" or "parent::node()" <?xml version="1.0"?> <foo> <bar> <world>technology</world> </bar> <baz> <hello>bonjour</hello> </baz> </foo> In my XSL, I have (I've stripped out/simplified the irrelivant stuff): <xsl:template match="/"> ... <xsl:apply-templates select="./*" mode="abc"/> ... </xsl:template> <xsl:template match="*" mode="abc"> ... <xsl:apply-templates select="./*" mode="abc"/> ... </xsl:template> <xsl:template match="*" mode="xyz">
...
<!--
check if this node, is (in the above case "foo")...
which if I'm understanding correctly, is the "document element node"???
which test, should I use?
-->
<xsl:choose>
<xsl:when test="not(parent::*)">
<!--
break, do whatever (I need to know when this
condition occurs, regardless, of what the name
of my tag "foo" is called.
-->
So, for my sample, printing
[<xsl:value-of select="name(.)"/>]
will print: [foo]
</xsl:when>
<xsl:otherwise>
<!-- continue, process this node's parent -->
<xsl:apply-templates select="parent::*" mode="xyz"/>
</xsl:otherwise>
</xsl:choose>
...
</xsl:template>Cheers, Steve On 10/20/2003 12:58 PM, Michael Kay wrote:: In a template, matching on "*", I need to test, if this node, is the document root node. 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
|

Cart








