[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Fwd: using xquey in XSLT transformation

Subject: RE: Fwd: using xquey in XSLT transformation
From: "Jim Earley" <xml.jim@xxxxxxxxx>
Date: Wed, 18 Mar 2009 17:52:12 -0600
RE:  Fwd: using xquey in XSLT transformation
You can declare your own functions in XSLT 2.0:


<xsl:stylsheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:local="your-namespace"
    version="2.0">
    <xsl:function name="local:getPic">
            <xsl:param name="node" as="node()"/>
            <xsl:param name="searchValue" as="xs:string"/>

        <xsl:choose>
            <xsl:when test="empty($searchvalue)">
                <xsl:sequence select="$node/pic-value"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:sequence
select="local:ref($node//data-declaration[name=$searchvalue[1]], $searchValue[postion()
!= 1])"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:function>
<xsl:stylesheet>

Cheers,


Jim Earley
Senior XML Architect
Flatirons Solutions Corp.
 
The important thing is not to stop questioning. Curiosity has its own reason for
existing - Albert Einstein

-----Original Message-----
From: Michalmas [mailto:michalmas@xxxxxxxxx] 
Sent: Wednesday, March 18, 2009 4:27 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Fwd: using xquey in XSLT transformation

Hello guys,

I have XQuery function. I need to use it in XSLT transformation. Is it possible?

d e c l a r e func t i on l o c a l : g e tPic ( $node as node ( )  ,
$ s ear chValue as x s : s t r i n g   )
 {
 i f ( empty ($ searchValue ) ) then
    $node/ pic-value

 e l s e
      l o c a l : r e f ($ node // de s c endant : :da ta-d e c l a r a t i o n
      [ name=$s earchValue [ 1 ] ] [ 1 ] ,
      $ searchValue [  p o s i t i o n ( )  !=  1 ] )
 };

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.