On 27/03/2008, Marney Cotterill <marney(_at_)crackerbrandware(_dot_)com> 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/
--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--