ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
Re: [xsl] How to fetch desired data
by rob Jackson other posts by this author
Dec 30 2005 4:54AM messages near this date
Re: [xsl] How to fetch desired data | Re: [xsl] How to fetch desired data
& XSLT 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@[...].uk>  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
> 
> 
>  --~------------------------------------------------------------------
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>  To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>  or e-mail: <mailto:xsl-list-unsubscribe@[...].com>
>  --~--
> 
> 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@[...].com> 
--~--
Thread:
rob Jackson
James Fuller
rob Jackson
Florent Georges
rob Jackson
Florent Georges
James Fuller
Florent Georges

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved