Re: [xsl] passing parameters to xsl stylesheets

Subject: Re: [xsl] passing parameters to xsl stylesheets
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Sun, 20 May 2007 18:07:55 +0200
Youness HAFFANE wrote:
Thanks a lot Xmlize,I tried it an it works very fine.
I've also tried this and it works too:

 <xsl:template match="/">
     <html>
     <body>
      <xsl:value-of select="note[to=$toto]/to" />



-----Original Message-----
From: mozer [mailto:xmlizer@xxxxxxxxx]


<xsl:template match="/note"> <html>
<body>
<xsl:value-of select="*[local-name()=$toto]" />

FYI: Note that there's a large difference between the two.


1. The first one (yours, with note[to = $toto]/to) selects all 'to' nodes where the contents is equal to the value of $toto:
$toto = 'Tove'
will select: <to>Tove</to>


2. The second one (from mozer, with *[local-name()=$toto]) will select all children nodes where the name of the node is equal to the value of $toto:
$toto = 'from'
will select: <from>Jani</from>


and, of course, you select only the 'to' nodes with a parent 'note', whereas mozer selects all children from node 'note' that match the name in $toto.

Cheers,
-- Abel Braaksma

Current Thread