|
Subject: Re: [xsl] XSL and XML Help From: Florent Georges <darkman_spam@xxxxxxxx> Date: Mon, 16 Oct 2006 19:30:43 +0200 (CEST) |
Wendell Piez wrote:
Hi
> At 06:00 PM 10/13/2006, Dr KM wrote:
> > > You can do this with a for-each instruction, but
> > > anything you can do with a for-each instruction you
> > > can do with templates
> > Excepted that template rules are applicable (mmh, not
> > sure this is correct English) only to nodes.
> This is interesting ... it's true in XSLT 2.0, but not in
> XSLT 1.0, where one can select only nodes when executing a
> for-each.
Yes.
> In XSLT 1.0, indeed, the content of a for-each instruction
> is formally called a "template", while what we commonly
> call a "template" is actually named a "template rule"
> (which usage I see you observe :-).
Yes, there were a lot of confusion between "template" and
"template rule". So XSLT 2.0 replaced "template" by
"sequence constructor". But in your initial sentence above,
I guess you meant "template rule", isn't it ?-)
> I suppose this is also not the case in XSLT 2.0?
Mmh, I'm not sure what you mean here?
A simple example for for-each vs/ apply-templates in XSLT
2.0. It is not "right" (for one definition of "right") to
write:
<xsl:function name="my:f">
<xsl:param name="p" as="item()+"/>
<xsl:apply-templates select="$p"/>
</xsl:function>
Write instead:
<xsl:function name="my:f">
<xsl:param name="p" as="item()+"/>
<xsl:for-each select="$p">
...
</xsl:for-each>
</xsl:function>
or:
<xsl:function name="my:f">
<xsl:param name="p" as="node()+"/>
<xsl:apply-templates select="$p"/>
</xsl:function>
or even:
<xsl:function name="my:f">
<xsl:param name="p" as="item()+"/>
<xsl:sequence select="for $i in $p return ..."/>
</xsl:function>
But I agree for-each is often over-employed, instead of
template rules.
Regards,
--drkm
___________________________________________________________________________
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions !
Demandez ` ceux qui savent sur Yahoo! Questions/Riponses
http://fr.answers.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XSL and XML Help, Wendell Piez | Thread | Re: [xsl] XSL and XML Help, Wendell Piez |
| Re: [xsl] [XSLT 2.0] Checking that , Abel Braaksma | Date | Re: [xsl] [XSLT 2.0] Checking that , Florent Georges |
| Month |