Created
October 5, 2013 19:23
-
-
Save JohnNilsson/6845089 to your computer and use it in GitHub Desktop.
XSLT to transform PList XML to something almost XML-like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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="/plist"> | |
<xsl:element name="theme"> | |
<xsl:apply-templates /> | |
</xsl:element> | |
</xsl:template> | |
<xsl:template match="dict"> | |
<xsl:for-each select="key"> | |
<xsl:element name="{text()}"> | |
<xsl:apply-templates select="following-sibling::*[1]"/> | |
</xsl:element> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template match="string"> | |
<xsl:value-of select="."/> | |
</xsl:template> | |
<xsl:template match="array"> | |
<xsl:for-each select="dict"> | |
<xsl:element name="setting"> | |
<xsl:apply-templates select="current()"/> | |
</xsl:element> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment