Mike and everyone else,
Thanks for the help. unfortuneately none of the example worked. I think it
may be b/c the xml has a parent element above Item:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<MPL Version="2.0">
<Item>
...
</Item>
</MPL>
I am using PHP5 for the transform and get this error:
runtime error: file jriver.xsl element element in jriver.php on line 16
Warning: xsl:element : invalid name in jriver.php on line 16
Also, I would actually like to rename the elements in the result tree,
something like this:
<playlist>
<tracklist>
<track>
<location>E:\Rap\DJ Mark Farina\Connect\Mark Farina - Connect - 08 -
Martin Venetjoki , Really Don't Stop.mp3</location>
<creator>DJ Mark Farina</creator>
</track>
...
</tracklist>
<playlist>
where Filename becomes location and Artist becomes creator.
thanks,
Dan
From: dan(_at_)streampad(_dot_)com
<Item>
<Field Name="Filename">E:\Rap\DJ Mark Farina\Connect\Mark
Farina - Connect
- 08 - Martin Venetjoki , Really Don't Stop.mp3</Field>
<Field Name="Artist">DJ Mark Farina</Field>
<Field Name="Album">Connect</Field>
<Field Name="Name">Martin Venetjoki , Really Don't Stop</Field>
<Field Name="File Type">mp3</Field>
<Field Name="Genre">Chill</Field>
<Field Name="Date">36526</Field>
<Field Name="Bitrate">128</Field>
<Field Name="Media Type">Audio</Field>
<Field Name="File Size">4196480</Field>
<Field Name="Duration">262</Field>
<Field Name="Track #">8</Field>
<Field Name="Date Created">1055524929</Field>
<Field Name="Date Modified">1054230842</Field>
<Field Name="Date Imported">1055529132</Field>
</Item>
This stylesheet does what you want over the data you've provided, but
fails
when the attribute names contain spaces, which are an error for element
names, IIRC. Saxon gives a warning in any case and does not create the
those elements.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/Item">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="Field">
<xsl:element name="{(_at_)Name}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
HTH,
-----------------------------------
Mike Haarman,
XSL Developer,
Internet Broadcasting Systems, Inc.
--~------------------------------------------------------------------
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>
--~--
http://www.streampad.com
username - dan
--~------------------------------------------------------------------
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>
--~--