Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2007, 06:24 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Splitting a attribute value

suppose here i'm getting my attribute value...
<xsl:if test="local-name() = 'TriggerText'">
                        <tr height="22"><td class="nodeprop">
                           <xsl:value-of select="name()"/>
                           </td><td class="nodevalue">
                            <xsl:value-of select="."/> </td></tr>
                        </xsl:if>
here i'm getting one attribute value like this......
&amp;#10;-- 12.08.97 K.W&ouml;rn - Neue Felder aufgenommen Tarifart, Bewertungsstichtag&amp;#10;-- 16.12.02 T. Loeken - CHR 7614: TrgPreUpdate TAR, Verkn&uuml;pfung korrigiert&amp;#10;-- 10.01.03 T. Loeken - CHR 7402: Vertikale Ausrichtung der

now i need to split it when ever i will get &amp;#10;..
so for that i need to store the value first then i have to split and display...but with the 'substring-before' and 'substring-after' i can only split the value in two part..may be..do i have to do a recursion..could u pls tell me how to store the value and how to do recursion...with the syntax those r very new to me...thnx
 
Old February 19th, 2007, 07:56 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This kind of thing is much easier if you use XSLT 2.0, which has regular expression support, but if you are forced to use XSLT 1.0 you need to do recursion. Look at the string-handling templates such as str:tokenize at www.exslt.org for examples (or in a good XSLT textbook)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 19th, 2007, 08:51 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have seen the link ..but i'm not getting it..can u pls give a working xml and xsl combination...thnx u for help
 
Old February 19th, 2007, 09:51 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

how to handle it by xslt2.0....if it is easier in xslt2.0 i have to go for that..can u give me the syntax..

 
Old February 19th, 2007, 11:13 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my java transformer also does't support xslt 2.0

 
Old February 19th, 2007, 11:55 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XSLT has a function tokenize() which uses regular expressions to split a value into a sequence of strings.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 19th, 2007, 11:57 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

This is a good site for reference:

http://www.w3schools.com/xpath/xpath_functions.asp

also this book:

http://www.wrox.com/WileyCDA/WroxTit...764569090.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
Splitting a form cwambua Classic ASP Databases 1 August 21st, 2005 11:31 PM
Splitting Strings ryanpatrick Classic ASP Basics 2 March 9th, 2004 02:42 PM
string splitting qwjunk Classic ASP Basics 5 February 2nd, 2004 05:59 AM
splitting this string menesesg Classic ASP Basics 1 September 10th, 2003 12:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.