RE: [xsl] explain of Joerg xslt (was: xsl:copy ...)

Subject: RE: [xsl] explain of Joerg xslt (was: xsl:copy ...)
From: "Matias Woloski" <woloski@xxxxxxxx>
Date: Sun, 7 Apr 2002 16:49:02 -0300
Carsten,
actually your xslt is much more understandable for me. I could follow its
logic... something that couldn't do it with Joerg's xslt.
Thanks for taking the time to fix yours. I will use Joerg's xslt as you
recommend but I would like to understand a few things.
I will write the lines number to the xslt :)

1 <xsl:stylesheet>
2    <xsl:key name="Indice" match="Indice" use="@IdRef"/>
3    <xsl:template match="TreeData">
4        <tree>
5            <xsl:apply-templates select="Indice[not(@IdRef)]"/>
6        </tree>
7    </xsl:template>

8    <xsl:template match="Indice">
9        <tree>
10           <xsl:apply-templates select="@*"/>
11           <xsl:apply-templates select="key('Indice', @IdIndice)"/>
12       </tree>
13   </xsl:template>

14   <xsl:template match="@*">
15        <xsl:copy-of select="."/>
16   </xsl:template>

17    <xsl:template match="@Nombre">
18        <xsl:attribute name="text"><xsl:value-of
select="."/></xsl:attribute>
19    </xsl:template>
20 </xsl:stylesheet>

So here are the questions
Lines 8 to 13. We are inside each "Indice" branch.
i) which is the difference between match and select attr of xsl:template?

ii) Why the Indice tag is changing for the tree tag? Only by putting the
<tree> tag inside the <xsl:template> which matchs the tag name Indice will
do the trick? This syntax wants to say: Match all Indice tags and when you
find each one parse and write <tree> <xsl:appl... </tree> instead of what
the Indice tag has inside it? hope you understand this question :)

iii) line 10. I cannot understand the concept of apply-templates.
this wants to say: Apply templates to all attributes inside Indice.? is this
done in order to make possible the apply of line 14-16?

iv) line 11. this means: apply templates to all Indice tags inside the
Indice tag being parsed. ?this is recursive, isn't it?

v) line 15. differences between xsl:copy and xsl:copy-of.

vi) line 15. The "dot" means: the content inside the attributes?

ok guys. that's all...
you're giving me really wealthy information. I appreciate your effort.
thanks,
Matias

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Carsten Klein
> Sent: domingo, 07 de abril de 2002 11:44
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Book recommendation (was: xsl:copy - change
> attributes and tag name)
>
>
> Hi Matias,
>
> I see that there is already a post by Joerg, who uses a key to
> locate elements in the document.
> This is much better, since keys increase overall performance,
> especially when dealing with
> large documents.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread