Subject: Re: [xsl] Understanding Identity Transformations From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Sat, 12 Feb 2005 11:30:49 +0100 |
Seems like this is pretty standard:
SAMPLE_001: <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
But then I've also seen this:
SAMPLE_002: <xsl:template match="/ | @* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
How do they compare? I make not of the SAMPLE_001 within the xsl:copy there are 2 apply templates, what does each do?
Yes indeed, it will strip off attributes BUT also text nodes, comments, processing instructions...Then, understanding what is happening, is the following sample true that this will strip an XML doc of all attribute elements?
SAMPLE_003: <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="*"/> </xsl:copy> </xsl:template>
And finally, when I identity transform the following my document i quadrupled in size, but I though I was following standard practices from previous example.
SAMPLE_004: <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="*"/> <xsl:apply-templates /> </xsl:copy> </xsl:template>
Ahh, I think I understand what is going on in SAMPLE_004 (please confirm) I am basically applying templates for all nodes twice
regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Gaudiam omnibus traderat W3C, nec vana fides
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Understanding Identity Tr, Dimitre Novatchev | Thread | Re: [xsl] Understanding Identity Tr, Karl Stubsjoen |
Re: [xsl] WordML to XML, Joris Gillis | Date | RE: [xsl] WordML to XML, Touchtel |
Month |