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

dynamic-context type-branching

Subject: dynamic-context type-branching
From: ac <ac@xxxxxxxxxxxxx>
Date: Sun, 03 Feb 2008 14:36:07 -0500
 dynamic-context type-branching
Hi,

In schema unaware xslt2 environments, what would be the best way to select action depending on the result type (ex: string, text node(s), attribute(s), element(s)) of saxon:evaluate(), ex:

idealy (v1) something like ...
<xsl:template match="context" mode="foo">
<xsl:param name="xpathstring" select="... some xpath string ... "/>
<xsl:apply-templates select="saxon:eval(saxon:evaluate($xpathstring)" mode="lama"/>
</xsl:template>


but since you cannot apply-templates on atomic types, alternately (v2) ...
<xsl:template match="context" mode="foo">
<xsl:param name="xpathstring" select="... some xpath string ... "/>
<xsl:variable name="tmp" select="saxon:eval(saxon:evaluate($xpathstring)"/>
<xsl:choose>
<xsl:when test="$tmp instance of xs:anyAtomicType"><xsl:value-of select="$tmp"/></xsl:when>
<xsl:otherwise><xsl:apply-templates select="$tmp" mode="lama"/></xsl:otherwise>
</xsl:choose>
</xsl:template>


Assuming mode="lama" has templates with appropriate matches for the different types.

Thanks,
ac

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.