Created
March 18, 2013 18:46
-
-
Save iwyg/5189703 to your computer and use it in GitHub Desktop.
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
<data> | |
<images> | |
<entry> | |
<image>myimage1.jpg</image> | |
</entry> | |
<entry> | |
<image>myimage2.jpg</image> | |
</entry> | |
<entry> | |
<image>myimage3.jpg</image> | |
</entry> | |
</images> | |
</data> |
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
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:variable name="quote"> | |
<xsl:text>"</xsl:text> | |
</xsl:variable> | |
<xsl:template match="/"> | |
<xsl:variable name="imagelist"> | |
[<xsl:apply-templates select="/data/images/entry/image" mode="imagelist"/>] | |
</xsl:variable> | |
<script>window.imageslist = <xsl:value-of select="$imagelist"/>;</script> | |
</xsl:template> | |
<xsl:template match="entry/image" mode="imagelist"> | |
<xsl:value-of select="concat($quote, .,$quote)"/> | |
<xsl:if test="position() != last()">,</xsl:if> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment