[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

xt:node-set usage (was Re: Future XSLT expansion.)


Subject: xt:node-set usage (was Re: Future XSLT expansion.)
From: Tom Myers <tom.myers@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Mar 2000 11:13:02 -0500

"Jon Smirl" <jonsmirl@xxxxxxxxxxxx> wrote

>Am I experiencing a side effect of this discussion?
>
>I would like to do this:
>
><xsl:variable name="foo">
>    <mytag>
>        data
>    </mytag>
></xsl:variable>
>
><xsl:apply-templates select="$foo"/>
>
>This gives me a "cannot convert to node-set error" with XT.
>It was my understanding that this was in XSLT to prevent
>feedback from the resultset back into the input of the pattern
>matches.
>
>Instead I use:
...
<xsl:apply-templates select="document('')/mydata"/>
>
>The downside to this is it causes my source XSL stylesheet to
>be parsed twice since XML and XSLT have different white
>space rules.

I'm puzzled. Why are you using that, which I think of as cute
but over-sophisticated, rather than just

  <xsl:apply-templates select="xt:node-set($foo)"/>

That works fine...I just tested it with your variable copied
from the email into a stylesheet, and

<xsl:template match="mytag" >
 <xsl:value-of select="."/>
</xsl:template>

to get the "mydata" value out...no problem, except that I
happened to test it in a stylesheet with a top-level

<xsl:template match="/">

which was immediately plunged into infinite regress, because
as you say, we get "feedback from the resultset back into the 
input of the pattern matches."(So I had to edit "/" to match 
the actual top node of the actual input xml file, before 
seeing that indeed, there was no problem.)

Maybe that _does_ have something to do with the philosophy
issue...I think it probably just means I need some more
coffee. But probably I'm misreading your mail somehow. The
feedback issue is interesting. Anybody want to philosophize
on it?

Tom Myers


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



Current Thread
Keywords