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 June 8th, 2006, 03:11 PM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parse a field


I have a field which could include one or 3 times <last, first> name appended together (eg for three 'last, firstlast, first Mlast, first').

How can I separate these three occurance properly with a '|' in below xslt code.

 The name field includes 0 to 3 NickNickNick, I need to parse it to ||| or Nick|Nick|Nick| or Nick|| or Nick|Nick||

        <xsl:choose>
            <xsl:when test="name[@type='other']">
                <xsl:apply-templates select="name[@type='other']"/>
                <xsl:text>|</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>|</xsl:text>
                <xsl:text>|</xsl:text>
                <xsl:text>|</xsl:text>
            </xsl:otherwise>
             <xsl:text>#10;</xsl:text>
        </xsl:choose>


Thanks for all your help,
Victoria


 
Old June 8th, 2006, 05:09 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sorry, I don't understand the format of your input. This description is about as obscure as you can get:

(eg for three 'last, firstlast, first Mlast, first').

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 8th, 2006, 06:09 PM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Below is what I see in my output, however the data could be in the format after my code change:

||
(last, first)
(last, firstlast, first)
(last, firstlast, firstlast, first)

Which I need to parse the data to

||||
|last, first|||
|last, first|last, first||
|last, first|last, first|last, first|

I hope this is clear....

- Victoria

 
Old June 9th, 2006, 02:00 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please explain what your input looks like.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 12th, 2006, 01:36 PM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default


This is how my output looks like:

||
(last, first)
(last, firstlast, first)
(last, firstlast, firstlast, first)

And, below is how it should look after the parse:

||||
|last, first|||
|last, first|last, first||
|last, first|last, first|last, first|

Thx,
Victoria

 
Old June 12th, 2006, 01:51 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I asked you what the input looked like.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 02:27 AM
Parse error: parse error, unexpected $end Ayodeji Adegbaju Pro PHP 3 January 12th, 2007 12:21 PM
parse error ajit_kunte Beginning PHP 2 May 6th, 2005 05:07 AM
Parse error kurt123 Beginning PHP 4 July 27th, 2004 02:28 PM
Parse Error :-( dean_custom PHP How-To 3 February 11th, 2004 02:12 AM





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