Subject: [xsl] XSLT 2.0 grouping and text nodes and mixed text From: Kenneth Reid Beesley <krbeesley@xxxxxxxxx> Date: Tue, 8 Dec 2009 16:52:23 -0700 |
<examples> <hop>source sentence 1</hop> translation of source sentence 1 <hop>source sentence 2</hop> translation of source sentence 2 <hop>source sentence 3</hop> a translation can be <emph>mixed</emph> text </examples>
<examples> <example-pair> <hop>source sentence 1</hop> <eng>translation of source sentence 1</eng> </example-pair> <example-pair> <hop>source sentence 2</hop> <eng>translation of source sentence 2</eng> </example-pair> <example-pair> <hop>source sentence 3</hop> <eng>a translation can be <emph>mixed</emph> text</eng> </example-pair> </examples>
<xsl:template match="examples"> <examples> <xsl:for-each-group select="*" group-starting-with="hop"> <example-pair> <!-- copy the hop element--> <xsl:copy-of select="."/> <!-- and then surround the mixed text following the hop element with eng tags --> <eng> <xsl:apply-templates select="current-group() except ."/> </eng> </example-pair> </xsl:for-each-group> </examples> </xsl:template>
<!-- default copying of the document --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
****************************** Kenneth R. Beesley, D.Phil. P.O. Box 540475 North Salt Lake, UT 84054 USA
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Confusing trace from Saxo, Michael Kay | Thread | Re: [xsl] XSLT 2.0 grouping and tex, G. Ken Holman |
RE: [xsl] Confusing trace from Saxo, Michael Kay | Date | [xsl] What short short XSLT 2.0 tut, Dimitre Novatchev |
Month |