xsl-list
[Top] [All Lists]

Re: [xsl] passing parameters to xsl stylesheets

2007-05-20 09:10:25
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(_at_)gmail(_dot_)com] <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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--