xsl-list
[Top] [All Lists]

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

2009-03-18 19:33:30

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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--