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

Re: Custom function in template match predicate

Subject: Re: Custom function in template match predicate
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Tue, 23 Sep 2008 19:40:00 +0200 (CEST)
Re:  Custom function in template match predicate
Ian Stokes-Rees wrote:

  Hi

>   <xsl:function name="my:test">
>     <xsl:param name="fmtcode"/>
>     <xsl:param name="context"/>
>     <xsl:choose>
>       <xsl:when test="substring-after($context/@format,':') =
> $fmtcode and
>
namespace-uri-for-prefix(substring-before($context/@format,':'),$context)
>         = 'http://example.com/schemas/formats' ">
>         <xsl:value-of select="boolean(1)"/>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:value-of select="boolean(0)"/>
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:function>

  I would use instead:

    <xsl:function name="my:test" as="xs:boolean">
       <xsl:param name="fmtcode" as="xs:string"/>
       <xsl:param name="context" as="element()"/>
       <xsl:sequence select="[ content of your when/@test ]"/>
    </xsl:function>

  Anyway, I would rather use resolve-QName() directly.

  PS: It is a good thing to include any error message you get when
posting.

  Regards,

--drkm

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.