Re: [xslt] Xpath on variables?



Le 06/08/01 17:40:34, Heiko Rupp a écrit :
> > if $foo is a result tree fragment.
> 
> How?

Read the spec!
http://www.w3.org/TR/xslt#section-Result-Tree-Fragments

> <xsl:variable name="foo">
> <FOO>
>         <BAR arg="1">
>         test
>         </BAR>
> </FOO>
> </xsl:variable>

  "If the variable-binding element does not have a select attribute
   and has non-empty content (i.e. the variable-binding element has
   one or more child nodes), then the content of the variable-binding
   element specifies the value. The content of the variable-binding
   element is a template, which is instantiated to give the value of
   the variable. The value is a result tree fragment equivalent to a
   node-set containing just a single root node having as children the
   sequence of nodes produced by instantiating the template."

> <xsl:copy-of select="$foo//BAR"/>

  "In particular, it is not permitted to use the /, //, and [] operators
   on result tree fragments."

> Xalan-C:

Which version?

> Saxon 6.4.3:

In <http://saxon.sourceforge.net/saxon6.4.3/conformance.html>
  "SAXON will automatically convert a result tree fragment to a node-set
  when required, as defined in the draft XSLT 1.1 specification."

Note that XSLT 1.1 has been given up, it is not normative, just a working
draft.

> libxslt 1.0.0:
> 
> xsltproc foo.xsl foo.xml
> Error xpath.c:7416: Invalid type
> Error xpath.c:7416: Invalid type

libxslt is XSLT 1.0 -conformant.

Tom.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]