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

problem with transforming mixed content

Subject: problem with transforming mixed content
From: "Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Aug 2020 02:15:57 -0000
 problem with transforming mixed content
Dear list,

I would like to ask for your help with the following mixed-content problem. I am receiving, from an external source, data in the following form:

<title>THE TITLE OF THE BOOK WITH SOME <i>ITALICS</i> AND SOME MORE WORDS: THE SUBTITLE OF THE BOOK WITH SOME <i>ITALICS</i></title>

What I would like to do is
1) separate the title from the subtitle (i.e., divide the data at the colon) and put each in a separate element node;
2) all the while maintaining the <i> markup;
3) and perform certain string manipulations on all of the text nodes; for the purposes of this post, I will use the example of converting upper-case to lower-case.


So the desired output is the following:

<title>the title of the book with some <i>italics</i> and some more words</title>
<subtitle>the subtitle of the book with some <i>italics</i></subtitle>


How can this be done?

I know that I can perform string manipulations while maintaining the <i> markup with templates, i.e., <xsl:template match="text()"/> and <xsl:template match="i"/>. But in this case I do not know how to divide the data at the colon. And I know that I can divide the data at the colon with <xsl:value-of select="substring-before(.,': ')"/>, but then I loose the <i> markup. So I am at a loss.

Thanks in advance for your help!
Wolfhart

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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-2013 All Rights Reserved.