|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Testing type of a param
A param's type can be any of
string, number, boolean, node-set
Within a called template I'd like to be able use <xsl:choose> to
branch based on whether a parameter is a node-set or not.
Is there a way to do this?
FYI, here is the template I'm trying to write; it is a general
purpose repeat function:
<!--
This template takes two parameters:
value - the thing to repeat.
n - the number of times to repeat it to the result tree.
If value is a node set, xsl:copy-of is used.
If value is a simple value, xsl:value-of is used.
-->
<xsl:template name="repeat">
<xsl:param name="value"/>
<xsl:param name="n"/>
<xsl:if test="$n != 0">
<xsl:choose>
<xsl:when test="?">
<!-- value is a node set, use copy-of -->
<xsl:copy-of select="$value"/>
</xsl:when>
<xsl:otherwise>
<!-- value is a simple type, use value-of -->
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="repeat">
<xsl:with-param name="n" select="$n - 1"/>
<xsl:with-param name="value" select="$value"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








