Subject: [xsl] sequence of strings From: Ruud Grosmann <r.grosmann@xxxxxx> Date: Tue, 02 Dec 2008 14:17:45 +0100 |
<?xml version="1.0" encoding="utf-8"?> <document> <BLD> <ITA/> </BLD> </document>
<?xml version="1.0" encoding="UTF-8"?> <!-- maak een stack van strings -->
<xsl:template match="/root"> <xsl:variable name='blop' as='xs:string*'> <xsl:call-template name='get_attributes'> <!-- make sequence of strings --> <xsl:with-param name='string' select='"style: italic;bold"'/> </xsl:call-template> </xsl:variable>
<document> <xsl:call-template name='nest'> <xsl:with-param name='lijst' select='$blop'/> </xsl:call-template> </document> </xsl:template>
<xsl:template name='nest'> <xsl:param name='lijst' select='zip'/> <xsl:choose> <xsl:when test="empty($lijst)"> <!-- end recursion --> <xsl:sequence select="()"/> </xsl:when> <xsl:otherwise> <xsl:element name="{$lijst[1]}"> <xsl:call-template name='nest'> <xsl:with-param name='lijst' select='$lijst[position() != 1]'/> </xsl:call-template> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:template>
<xsl:template name='get_attributes'> <xsl:param name='string' select='zip'/> <xsl:variable name='blip' as='xs:string*' select="for $h in ('bold', 'italic') return if (contains($string, $h)) then $h else ()"/> <xsl:sequence select="for $h in $blip return if ($h = 'bold') then 'BLD' else if ($h = 'italic') then 'ITA' else ()" /> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] populate nodelist variabl, David Carlisle | Thread | RE: [xsl] sequence of strings, Michael Kay |
Re: [xsl] automatic creation of nes, Ganesh Babu N | Date | RE: [xsl] sequence of strings, Michael Kay |
Month |