Subject: Re: [xsl] Fwd: using xquey in XSLT transformation From: Michalmas <michalmas@xxxxxxxxx> Date: Thu, 19 Mar 2009 23:32:23 +0100 |
Absolutely it is possible. The error was about typo in posItion() funtion... M. On Thu, Mar 19, 2009 at 10:42 PM, Michalmas <michalmas@xxxxxxxxx> wrote: > Is it possible to call the function recursively: > > B <xsl:function name="local:getNodeType"> > B B B B B B B B B <xsl:param name="node" as="node()*"/> > B B B B B B B B B <xsl:param name="searchValue" as="xs:string*"/> > > B B B <xsl:choose> > B B B B B <xsl:when test="empty($searchValue)"> > B B B B B B B <xsl:sequence select="$node/pic-value"/> > B B B B B </xsl:when> > B B B B B <xsl:otherwise> > B B B B B B B <xsl:sequence > select="local:getNodeType($node//data-declaration[name=$searchvalue[1]][1], > $searchValue[postion() != 1])"/> <!--HERE--> > B B B B B </xsl:otherwise> > B B B </xsl:choose> > B </xsl:function> > > > As it doesn't work (Unknown function) > > thanks! > > > On Thu, Mar 19, 2009 at 12:52 AM, Jim Earley <xml.jim@xxxxxxxxx> wrote: >> You can declare your own functions in XSLT 2.0: >> >> >> <xsl:stylsheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> B B xmlns:xs="http://www.w3.org/2001/XMLSchema" >> B B xmlns:local="your-namespace" >> B B version="2.0"> >> B B <xsl:function name="local:getPic"> >> B B B B B B <xsl:param name="node" as="node()"/> >> B B B B B B <xsl:param name="searchValue" as="xs:string"/> >> >> B B B B <xsl:choose> >> B B B B B B <xsl:when test="empty($searchvalue)"> >> B B B B B B B B <xsl:sequence select="$node/pic-value"/> >> B B B B B B </xsl:when> >> B B B B B B <xsl:otherwise> >> B B B B B B B B <xsl:sequence >> select="local:ref($node//data-declaration[name=$searchvalue[1]], $searchValue[postion() >> != 1])"/> >> B B B B B B </xsl:otherwise> >> B B B B </xsl:choose> >> B B </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: [xsl] 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 ( ) B , >> $ s ear chValue as x s : s t r i n g B ) >> B { >> B i f ( empty ($ searchValue ) ) then >> B B $node/ pic-value >> >> B e l s e >> B B B 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 >> B B B [ name=$s earchValue [ 1 ] ] [ 1 ] , >> B B B $ searchValue [ B p o s i t i o n ( ) B != B 1 ] ) >> B };
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Fwd: using xquey in XSLT , Michalmas | Thread | [xsl] [xslt] using xquey in XSLT tr, Michalmas |
Re: [xsl] Display link text as a hy, Martynas Jusevicius | Date | [xsl] Interrogating attributes valu, Charles Flanders |
Month |