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

Re: How to fetch desired data

Subject: Re: How to fetch desired data
From: rob Jackson <robjackson2002@xxxxxxxxx>
Date: Fri, 30 Dec 2005 18:23:36 +0530
regex city
Hi Jim,

Thanks for your reply.
'<xsl:' is prefixed just for example purpose. Pls ignore it.

By using substring-before comma I am able to get
<city>Charles Army Street; Boston</city>

but substring-after comma gives me 'Ma 01779'

I want this also to be split as
<state>Ma</state>
<zip>01779</zip>

How can I use substring-after to first store 'Ma 01779' into some
variable and then I can use substring-before and substring-after space
to get the values in different tags.

Pls suggest.


-Rob
On 12/30/05, James Fuller <jim.fuller@xxxxxxxxxxxxxx> wrote:
> rob Jackson wrote:
>
> >Hi All,
> >
> >
> >I am converting a source xml into target xml using XSLT.
> >
> >My source xml has a field like
> ><xsl:address>Charles Army Street; Boston, Ma 01779</xsl:address>
> >
> >
>
> there is no such thing as an xsl:address instruction in any version of
> XSLT, would suggest u use a different element name (or more precisely a
> different namespace).
>
> >I have to display it by breaking it into different fields assuming
> >there will be comma
> >between city and state and space between state and zip.
> >
> >Target xml should be like this:
> ><xsl:city>Charles Army Street; Boston</xsl:city>
> ><xsl:state>Ma</xsl:state>
> ><xsl:zip>01779</xsl:zip>
> >
> >
>
> once again, u seem to want to put everything in the xsl namespace (using
> xsl: prefix).....no need for this.
>
> As for how you would crack/split apart the <address/> element, I would
> suggest to use a combination of
>
> string-before() or string-after()
>
> (info here
> http://www.zvon.org/xxl/XSLTreference/Output/function_substring-after.html)
>
> or
>
> regex approach with EXSLT at http://www.exslt.org/regexp/index.html
>
> or
>
> if u are using XSLT v2.0 then use its native regex processing capability.
>
> gl, Jim Fuller

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.