We Recommend

Beginning XML Beginning XML
The perfect resource for beginning XML programmers, this guidebook shows you what XML is, how to use it, and what technologies surround it. The authors build on the strengths of previous editions while covering the latest changes in the XML landscape such as XQuery, RSS and Atom, and Ajax.


Posted By

koncept on 01/16/07


Tagged

xml apple XSL itunes transform


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

basicmagic


Transform iTunes Music Library XML


Published in: XML 


  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version = "1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4. <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>
  5.  
  6. <xsl:template match="/">
  7. <songlist>
  8. <xsl:apply-templates select="plist/dict/dict/dict"/>
  9. </songlist>
  10. </xsl:template>
  11.  
  12. <xsl:template match="dict">
  13. <song>
  14. <xsl:apply-templates select="key"/>
  15. </song>
  16. </xsl:template>
  17.  
  18. <xsl:template match="key">
  19. <xsl:element name="{translate(text(), ' ', '_')}">
  20. <xsl:value-of select="following-sibling::node()[1]"/>
  21. </xsl:element>
  22. </xsl:template>
  23. </xsl:stylesheet>

Report this snippet 

You need to login to post a comment.