Subject: RE: [xsl] text nodes From: <Jarno.Elovirta@xxxxxxxxx> Date: Thu, 15 Apr 2004 14:21:00 +0300 |
Hi, > Suggestions? Solutions? Don't know if this approach is generic enough for your purposes, but seems to work <xsl:template match="/"> <div> <xsl:apply-templates /> </div> </xsl:template> <xsl:template match="b"/> <xsl:template match="c"> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="d"> <d> <xsl:apply-templates/> </d> </xsl:template> <xsl:template match="a"> <l> <xsl:variable name="text" select="descendant::text()[1]"/> <xsl:if test="not(string(number(substring($text, 1, 1))) = 'NaN')"> <xsl:attribute name="n"> <xsl:value-of select="substring-before(concat($text, ' '), ' ')"/> </xsl:attribute> </xsl:if> <xsl:apply-templates/> </l> </xsl:template> <xsl:template match="a//text()" > <xsl:choose> <xsl:when test="not(preceding::text()[generate-id(ancestor::a[1]) = generate-id(current()/ancestor::a[1])])"> <xsl:choose> <xsl:when test="string(number(substring(., 1, 1))) = 'NaN'"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring(., string-length(substring-before(concat(., ' '), ' ')) + 1)"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> Cheers, Jarno - Massiv in Mensch: Kunstmutter
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] text nodes, Michael Kay | Thread | RE: [xsl] text nodes, James Cummings |
Re: [xsl] text nodes, David Carlisle | Date | RE: [xsl] Looking for Tools & Books, cknell |
Month |