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

RE: Re: How to match a element + part of an immediate

Subject: RE: Re: How to match a element + part of an immediate text sibling?
From: kakridge@xxxxxxxxxxxxx
Date: Wed, 14 Jan 2004 01:17:58 -0500
html to html xslt
I'm pretty new to XSL myself, so I will probably be corrected.  I am not
aware functionality that can select a specific word based on the order
it is within a node.  The only way I know to do that is with
substring-before and substring-after.

This HTML/XML:

<p> the quick
	<em>brown</em>
	fox jumps
</p>

Transformed with this Style Sheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<xsl:template match="p">
	<html>
		<p>
			<xsl:value-of select="concat(' ',
substring-before(substring-after(., ' '), ' '), ' ')"/>
			<em>
				<xsl:value-of
select="substring-before(substring-after(substring-after(., ' '), ' '),
em)"/>
				<xsl:value-of select="concat(' ', em, '
')"/>
				<xsl:value-of
select="substring-before(substring-after(., em), ' ')"/>
			</em>
			<xsl:value-of select="concat(' ',
substring-after(substring-after(., em), ' '))"/>
		</p>
	</html>	
</xsl:template>

</xsl:stylesheet>

Produces this HTML source code with MSXML:

<html xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<p> the <em>quick
	 brown 
	fox</em> jumps
</p>
</html>




-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chulsung Kim
Sent: Tuesday, January 13, 2004 11:15 PM
To: xsl-list
Subject:  Re: How to match a element + part of an immediate text
sibling?

Sorry for the newbie question. I did search the archive, but I guess I
just
didn't know what keywords to use.

Say you are doing an HTML-to-HTML transformation and you want to
transform:
<p> the quick <em>brown</em> fox jumps </p>to:
<p> the <em>quick brown fox</em> jumps </p>How would you match the <em>
element and the two words immediately surrounding it, so you can
rearrange
them in the template? Or would you match p[em] instead and then
rearrange
its children somehow?

Thanks,
Chulsung Kim


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.