[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: grouping problem

Subject: Re: grouping problem
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Nov 2007 17:54:54 -0500
Re:  grouping problem
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:

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

</test>

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

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

producing

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

</test>

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
attributes?

No.


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.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.