Re: [xsl] grouping problem

Subject: Re: [xsl] grouping problem
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Nov 2007 17:54:54 -0500
At 2007-11-28 10:46 -0500, Terry Ofner wrote:
I do have a more general question/clarification that perhaps someone
can address.

Say I want to replace an element and its attributes with a new
element name and attribute(s). Say I also want to keep the mark-up of
the content. I have noticed that if I use <xsl:value-of select "."/>
the content mark-up is stripped out. So with this content:

  <selection name="u1pt01">
    <para> text, more text, <i>italic text.</i> </para>


The following template would strip out the <i> tags,

<xsl:template match="selection">
        <para aim:pstyle='bodytext'><xsl:value-of select "para"/><para>


  <selection name="u1pt01">
    <para aim:pstyle='bodytext'> text, more text, italic text. </para>


Am I correct?

Yes. The value of an element node is the concatenation in document order of all descendent text nodes.

To avoid stripping content mark-up, I need to use <xsl:copy-of select
"para"/>. When I do that, however, I get two <para> tags.

You could use <xsl:copy-of select="para/node()"/> if you don't need to intervene on the descendent nodes, but perhaps using apply-templates and the identity template you would have a more general solution.

With copy-of, is it still possible to replace elements and


I suspect that I am missing something very basic. Some
clarification would be great.

copy-of copies the nodes without an opportunity for intervention ... for intervention, use apply-templates.

I hope this helps.

. . . . . . . . . . . . Ken

Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread