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

Re: Modification to The CSV to XML transform XSLT v2 f

Subject: Re: Modification to The CSV to XML transform XSLT v2 from Andrew Welch
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Thu, 27 Mar 2008 10:02:31 +0000
 Re: Modification to The CSV to XML transform XSLT v2 f
On 27/03/2008, Marney Cotterill <marney@xxxxxxxxxxxxxxxxxxxx> wrote:
>  And the output XML I get from my test CSV using the above stylesheet is:
>
>  <?xml version="1.0" encoding="US-ASCII"?>
>  <root>
>     <row>
>         <elem name="classDay">Monday</elem>
>         <elem naem="classTime">11am</elem>
>     </row>
>     <row>
>         <elem name="classDay">Tuesday</elem>
>         <elem naem="classTime">12pm</elem>
>     </row>
>  </root>
>
>  So hence, what I would like is for the output to be:
>  ....
>     <row>
>         <classDay>Monday</classDay>
>         <classTime>11am</classTime>.......etc
>
>  Can we just modify this portion of the stylesheet:
>
>                 <elem name="{.}">
>                 <xsl:value-of select="$lineItems[$pos]" />
>                 </elem>

Sure, just change it to:

<xsl:element name="{.}">
   <xsl:value-of select="$lineItems[$pos]" />
</xsl:element>

...but it will fail for any column names that aren't valid XML Names,
which is why the name is put in an attribute.

If you do have problems, I would recommend leaving this transform
as-is, then running another transform over the result to convert the
attributes values to element names which handles any problem names.


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.