Re: [xsl] On the XPath to my editor....

Subject: Re: [xsl] On the XPath to my editor....
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 17 May 2002 09:52:54 +0100
Hi Mark,

>  <xsl:for-each select="$schema">
>         <xsl:apply-templates select="saxon:evaluate($xsd-path)"/>  
> </xsl:for-each>
>
> But, I feel a little wierd about using for-each like this. Seems
> like there should be a way to do this without running the risk of
> having the "for loop" and the possibiliy of my apply templates
> getting called more than once.

Yes, but this is the only way to do it in XSLT 1.0. In XSLT 2.0, due
to general steps in XPath 2.0, we'll be able to do:

  $schema/saxon:evaluate($xsd-path)

which has the advantage that the results of the evaluated path will be
unioned together, so even if there's more than one node being held by
the $schema variable, but they're all in the same document, you'll
only get one of each within the sequence.

The other method that you could try is:

  saxon:evaluate(concat('$schema', $xsd-path))

or, if that doesn't work (I can't remember whether Saxon allows
variables within saxon:evaluate() or not), you could use:

<xsl:variable name="schema"
  select="'document(//@xsi:noNamespaceSchemaLocation)'" />
<xsl:apply-templates
  select="saxon:evaluate(concat($schema, $xsd-path))" />

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread