Good morning
In my simplified example, I have self closing 'e' elements that have a tag
attribute that denotes the start and end points of where style (in this
case bold and italic) should be applied.
I want to group the content within the start and end markers, and create a
wrapper element based on the tag attribute.
My XSLT skills are limited. Through trial and error, the following template
groups the content I want between the start and end 'b' markers.
<xsl:template match="*[@tag='b']">
<xsl:element name="{@tag}">
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="following::node() except
following::node()[@tag='/b'][1]/following::node()"/>
</xsl:element>
</xsl:template>
But as this template is part of an identity transform, I'm getting
duplicate content, so I need to suppress the following nodes that I have
already grouped. This is the part that I am stuck on. Any guidance would be
appreciated.
*Input*
<?xml version="1.0" encoding="UTF-8"?>
<paragraph>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas facilisis diam ac mi molestie faucibus. <e tag="b"/>Nulla
facilisi<e tag="/b"/>. Ut molestie metus arcu, ut vestibulum dolor
dignissim ut. <e tag="b"/>Cras tempor tortor libero, <e tag="i"/>non
pretium ipsum efficitur vitae. Nulla facilisi. Sed maximus varius purus, in
egestas justo<e tag="/i"/>. Nam eleifend metus vel odio rutrum auctor<e
tag="/b"/>. Proin scelerisque purus pellentesque, congue quam quis,
interdum lectus. Fusce accumsan sapien non turpis scelerisque, vel
efficitur ligula rhoncus.</paragraph>
*Desired Output*
<?xml version="1.0" encoding="UTF-8"?>
<paragraph>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas facilisis diam ac mi molestie faucibus. <b>Nulla facilisi</b>. Ut
molestie metus arcu, ut vestibulum dolor dignissim ut. <b>Cras tempor
tortor libero, <i>non pretium ipsum efficitur vitae. Nulla facilisi. Sed
maximus varius purus, in egestas justo</i>. Nam eleifend metus vel odio
rutrum auctor</b>. Proin scelerisque purus pellentesque, congue quam quis,
interdum lectus. Fusce accumsan sapien non turpis scelerisque, vel
efficitur ligula rhoncus.</paragraph>
Many thanks.
--
Keith
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--