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

RE: processing multiple values in a single attribute

Subject: RE: processing multiple values in a single attribute
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 15 May 2009 23:14:22 +0100
RE:  processing multiple values in a single attribute
In XSLT 2.0 you can do 

<xsl:for-each select="tokenize(@FAULTS, ' ')">

to iterate over the values.

If you're stuck with XSLT 1.0, there's str:tokenize in the EXSLT library


Michael Kay

> -----Original Message-----
> From: Charlie O [mailto:charlieo0@xxxxxxxxxxx] 
> Sent: 15 May 2009 22:17
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  processing multiple values in a single attribute
> I could help with a problem I haven't been confronted with 
> until now. I am converting SGML into well-formed XML, then 
> using XSLT to restructure/re-tag the XML to a different DTD.
> I need to convert each value of single attribute to an XML structure. 
> I'm not really sure where to start. I'm using XSL 1.0. I 
> started with a for-each for the attribute FAULTS itself, but 
> that's not the result I need. I basically need to traverse 
> through each value of FAULTS
> Here is my input element:
> <FAULT-REF FAULTS="PF01 PF02 PF03 PF04 PF05 PF06 PF07 PF08 
> PF09 PF10 PF11">
> I need transfrom each value of "FAULTS" (PF01, PF02, etc)  into this:
> <statemanipulation>
>     <variableref name="PF01"/>
>         <fault fault-code="PF01" fault-state="ok"/> 
> </statemanipulation> <statemanipulation>
>     <variableref name="PF02"/>
>         <fault fault-code="PF02" fault-state="ok"/> 
> </statemanipulation> <statemanipulation>
>     <variableref name="PF03"/>
>         <fault fault-code="PF03" fault-state="ok"/> 
> </statemanipulation> ..
> ..
> ..
> etc.
> Any help would be much appreciated.
> This list has been a huge benefit to me. Thanks to the 
> contributors here, I've had many "AHA" moments and I want to 
> thank everyone for there assistance in the past.
> Charles Flanders

Current Thread


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.
First Name
Last Name
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.