Re: [xsl] XSLT and XML in the same document

Subject: Re: [xsl] XSLT and XML in the same document
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 29 May 2007 11:11:01 +0100
On 5/29/07, David Carlisle <davidc@xxxxxxxxx> wrote:

> It's been a while since I bothered with this, but I think the pattern > goes something like: > > <xsl:variable name="foo-rtf"> > > and > > <xsl:variable name="foo"> > <xsl:choose> > <xsl:when test="function-available(...)"> > ....

the problem is that that pattern makes $foo into an rtf again so you are
back where you started (or at least you are a line or two further on,
but you have to keep nesting with consequent doubling in code paths
everywhere you need to call the function.

er, yeah. So it should be:


<xsl:variable name="foo-msxml" select="msxsl:node-set()"/>
<xsl:variable name="foo-exslt" select="exslt:node-set()"/>

<xsl:variable name="is-msxml">
 <xsl:choose>
   <xsl:when test="function-available(msxsl:node-set())">true</
  ..
..

and then in the body of the code:

<xsl:choose>
 <xsl:when test="$is-msxml">...

or some other long-winded, verbose approach.  Oh don't forget
whitespace.  Then then different versions of MSXML and whether they're
in side-by-side or replace mode.  Then there's whether the result tree
is serialized or parsed directly... and um loads of other
considerations that I don't know because I gave up long ago and move
to the garden of peace and tranquility that is XSLT 2.0.

> I guess its good that people persist with client side XSLT (as one day
> it might be worthwhile), but I reckon its just a hangover from the
> original intentions of XML.

heretic.

:) pragmatist more like... (but I agree that client side transforms are some kind of religion)

Current Thread