Subject: Re: [xsl] mixed content grouping by whitespace From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx> Date: Sun, 11 Apr 2010 21:17:28 +0200 |
On 11.04.2010 19:43, David Carlisle wrote: > On 11/04/2010 17:37, James Cummings wrote: > group-starting-with="text()"> > > > probably that wants to be text()[not(normalize-space(.))] > > David
==========8<------------------------ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0" exclude-result-prefixes="xs tei" >
<xsl:template match="tei:seg" > <xsl:copy> <xsl:variable name="sep"> <xsl:apply-templates mode="sep" /> </xsl:variable> <xsl:for-each-group select="$sep/node()" group-adjacent="boolean(self::tei:seg[@type='sep'])"> <xsl:choose> <xsl:when test="current-grouping-key()"> <xsl:value-of select="current-group()" /> </xsl:when> <xsl:otherwise> <w xmlns="http://www.tei-c.org/ns/1.0"> <xsl:apply-templates select="current-group()"/> </w> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:copy> </xsl:template>
<xsl:template match="tei:seg/text()" mode="sep"> <xsl:analyze-string select="." regex="\s+"> <xsl:matching-substring> <seg type="sep" xmlns="http://www.tei-c.org/ns/1.0"> <xsl:value-of select="."/> </seg> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:template>
<xsl:template match="@* | *" mode="#all"> <xsl:copy> <xsl:apply-templates select="@* | node()" mode="#current"/> </xsl:copy> </xsl:template>
</xsl:stylesheet> ==========8<------------------------
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] mixed content grouping by, David Carlisle | Thread | Re: [xsl] mixed content grouping by, G. Ken Holman |
Re: [xsl] mixed content grouping by, David Carlisle | Date | Re: [xsl] embed Base64 content into, Hermann Stamm-Wilbra |
Month |