[xsl] manipulating text and not losing elements

Subject: [xsl] manipulating text and not losing elements
From: Spencer Tickner <spencertickner@xxxxxxxxx>
Date: Thu, 13 Oct 2005 06:39:02 -0800
Hello everyone, and thanks in advance for the help.

I have the following issue, I'm dealing with an xml document with
character tags such as italic and bold splattered throughout the
document. The problem is when I want to retain these tags but
substring out some information as well. For instance.

<xml version="1.0">
<document>
<sender>someone@xxxxxxxxxxx</sender>
<indent1>1245 This is some indented text with <italic>Italic</italic>
and <bold>bold</bold> text</indent1>
<paragraph>1246 Italic and bold tags are not limited  they can
<italic>appear</italic> anywhere within the document</paragraph>
</document>

Ok, now I usually deal with this with the old: (just a snippet)

<xsl:template match="indent1>
<p class="indent1"><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="italic">
<em><xsl:apply-templates/></em>
</xsl:template>

<xsl:template match="bold">
<strong><xsl:apply-templates/></strong>
</xsl:template>

But what happens in the scenario where I want to remove the numbers
right after the indent1 and paragraph tags, as far as I can see the
only way to accomplish this is with substring, but using a substring
requires outputting using <xsl:value-of> which negates all following
children.  Ultimately I would like the line tagged as <indent1> to
read the following:

<p classs="indent1">This is some indented text with <em>Italic</em>
and <strong>bold</strong> text</p>

Ok, hopefully that illustrates my problem well. Thanks in advance for
any help you guys can offer.

Cheers,

Spencer

Current Thread