xsl-list
[Top] [All Lists]

RE: Exsl functions in xslt 2

2004-01-19 08:58:47

change the top level xsl:stylesheet to say version="2.0"
and add:

<xsl:function  name="msxsl:node-set" as="document-node()"> 
<xsl:param name="x"/> <xsl:sequence select="$x"/> </xsl:function>

saxon6 and msxml will process in forward-compatible mode and 
that will be OK, saxon 7 will define this function as an identity.

Done, Saxon 6.5.3 and MSXML 4 still work fine thanks.


It will process in native xslt2 mode which may or may not be 
OK, depending on what you are doing, you may need to persuade 
it back to backward compatibility mode if that can be done 
without harming compatibility. (One way woul dbe to _only-) 
have the above definition in the top level xslt2 stylesheet 
and have taht stylesheet import or include the previous 
stylesheet that has a top level version=1.0.

I tried this but of course got problems with data typing.  I tried
having a stylesheet with version="2.0" import a stylesheet with
version="1.0" and vice versa, but both produced the same set of errors
(with Saxon 7.8).

There were only 2 types of error, they were:

  Required type of first argument of format-number() is number; supplied
value has type xs:string

  and

  Required type of first argument of concat() is xs:string; supplied
value has type xs:integer

So for example I changed:

<xsl:value-of
select="format-number(substring($figureDigits,1,2),'#0')"/>

To:

<xsl:value-of
select="format-number(xs:integer(substring($figureDigits,1,2)),'#0')"/>

And added these function definitions:

<exsltf:function name="xs:integer">
  <xsl:param name="x"/>
  <exsltf:result select="$x"/>
</exsltf:function>

<exsltf:function name="xs:string">
  <xsl:param name="x"/>
  <exsltf:result select="$x"/>
</exsltf:function>

....but msxml4 complains about the 'xs:' namespace.

Any ideas?

ahanks
andrew

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



<Prev in Thread] Current Thread [Next in Thread>