[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Custom function in template match predicate
Hi,
I currently have some very unwieldy predicates showing up in lots of xsl:template/@match statements, of the form:
which aim to match different <foo> elements based on the @format QName value, e.g.:
and which do QName expansion so the user can choose the prefix. I would like to replace the "match" statement with a simplified custom function of the form: <xsl:template match="foo[ my:test('type1',.) = true ]"> where my:test is defined as: <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> The problem is, this doesn't work with Saxon8B. Would others expect this to work with different XSLT v2.0 processors? Is there some way to get this to work with Saxon8B? Cheers, Ian -- Ian.Stokes-Rees@xxxxxxxxxxxx +1 (617) 418-4168 SP Metric Limited, Technology Consulting
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|