Re: [xsl] Fwd: using xquey in XSLT transformation

Subject: Re: [xsl] Fwd: using xquey in XSLT transformation
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 18 Mar 2009 23:33:06 GMT
Your processor may have an extension to call xquery from xslt, but since
the body of this function is just xpath, it's just a trivial syntactic
change to write it as an xsl function, which would avoid the need for
any extension.

declare function local:getPic($node as node (),
$searchValue as xs:string)
 {
 if (empty($searchValue)) then
    $node/ pic-value

 else
      local:ref($node//descendant::data-declaration
      [ name=$searchValue[1]][1],
    $searchValue[position()!=1])
};



is

<xsl:function name="local:getPic">
  <xsl:param name="node" as="node()"/>
  <xsl:param name="searchValue" as="xs:string"/>
  <xsl;sequence select=" if (empty($searchValue)) then
    $node/ pic-value

 else
      local:ref($node//descendant::data-declaration
      [ name=$searchValue[1]][1],
    $searchValue[position()!=1])
"/>
</xsl;function>

together with xmlns:local="data:,anything" on xsl:stylesheet. of
course you'd need to translate local:ref as well.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread