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

How to use xsl:substring-before in XSLT 2.0

Subject: How to use xsl:substring-before in XSLT 2.0
From: Selva Ganesh <selvaganesh1985@xxxxxxxxx>
Date: Sun, 10 May 2009 08:12:38 +0530
 How to use xsl:substring-before in XSLT 2.0
Hi All,

This is my input:

<p class="LegLevel3Amend">&#8220; &#8220;the Framework
Directive&#8221; means Directive 2007/46/EC of the European Parliament
and of the Council of 5 September 2007 establishing such vehicles(<a
class="LegFootnoteRef" href="#f00003" title="Go to footnote 3"
id="Backf00003">3</a>);&#8221; ;</p>

Actually I expected output:

<defl>
<defli>&ldquo;<termd href="d001">&ldquo;the Framework
Directive&rdquo;</termd> means <def id="d001"><cit><loc>Directive
2007/46/EC of the European Parliament and of the Council of 5
September 2007</loc></cit> establishing such vehicles
</def>;&rdquo;;</defli>

I wrote the xslt coding:

<hov:template match="p[@class[.='LegLevel3Amend']]">
<defl>
<defli>
<hov:apply-templates select="text()"></hov:apply-templates>
</defli>
</defl>
</hov:template>

<hov:template match="text()">
<hov:value-of select="substring-before(.,' ')"></hov:value-of>
<termd>
<hov:value-of select="substring-before(substring-after(.,'
&#8220;'),'&#8221;')"></hov:value-of>
</termd> <dif>
<hov:value-of select="substring-after(.,'&#8221; ')"></hov:value-of>
</dif>
</hov:template>

I got the output from xslt executed

<defl><defli>&ldquo;<termd>the Framework Directive</termd><dif>means
Directive 2007/46/EC of the European Parliament and of the Council of
5 September 2007 establishing such
vehicles(</dif>);&rdquo;<termd></termd><dif>;</dif></defli></defl>

The text() function was executed unnecessary location, and remove the
some content, can you correct the coding or suggest any other function

Thanks,
Selva

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.