Revision: 28410
Updated Code
at July 8, 2010 05:06 by davidjohnevans
Updated Code
<!-- The stylesheet will transform this XML document: <doc> <SortPrefixAndTitle>3|Third Course</SortPrefixAndTitle> <SortPrefixAndTitle>1|First Course</SortPrefixAndTitle> <SortPrefixAndTitle>2|Second Course</SortPrefixAndTitle> </doc> into: <courseTitles> <courseTitle>First Course</courseTitle> <courseTitle>Second Course</courseTitle> <courseTitle>Third Course</courseTitle> </courseTitles> --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <courseTitles> <xsl:apply-templates select="//SortPrefixAndTitle"> <xsl:sort select="substring-before(.,'|')"> </xsl:sort> </xsl:apply-templates> </courseTitles> </xsl:template> <xsl:template match="SortPrefixAndTitle"> <xsl:variable name="title" select="substring-after(.,'|')" /> <courseTitle> <xsl:value-of select="$title" /> </courseTitle> </xsl:template> </xsl:stylesheet>
Revision: 28409
Updated Code
at July 8, 2010 03:06 by davidjohnevans
Updated Code
<!-- The stylesheet will transform this XML document: <doc> <SortPrefixAndTitle>3|Third Course</SortPrefixAndTitle> <SortPrefixAndTitle>1|First Course</SortPrefixAndTitle> <SortPrefixAndTitle>2|Second Course</SortPrefixAndTitle> </doc> into: <courseTitles> <courseTitle>First Course</courseTitle> <courseTitle>Second Course</courseTitle> <courseTitle>Third Course</courseTitle> </courseTitles> --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <courseTitles> <xsl:apply-templates select="//SortPrefixAndTitle"> <xsl:sort select="substring-before(.,'|')"> </xsl:sort> </xsl:apply-templates> </courseTitles> </xsl:template> <xsl:template match="SortPrefixAndTitle"> <xsl:variable name="title" select="substring-after(.,'|')" /> <courseTitle> <xsl:value-of select="$title" /> </courseTitle> </xsl:template> </xsl:stylesheet>
Revision: 28408
Updated Code
at July 8, 2010 03:05 by davidjohnevans
Updated Code
<!-- The stylesheet will transform this XML document: <code> <doc> <SortPrefixAndTitle>3|Third Course</SortPrefixAndTitle> <SortPrefixAndTitle>1|First Course</SortPrefixAndTitle> <SortPrefixAndTitle>2|Second Course</SortPrefixAndTitle> </doc> into: <courseTitles> <courseTitle>First Course</courseTitle> <courseTitle>Second Course</courseTitle> <courseTitle>Third Course</courseTitle> </courseTitles> --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <courseTitles> <xsl:apply-templates select="//SortPrefixAndTitle"> <xsl:sort select="substring-before(.,'|')"> </xsl:sort> </xsl:apply-templates> </courseTitles> </xsl:template> <xsl:template match="SortPrefixAndTitle"> <xsl:variable name="title" select="substring-after(.,'|')" /> <courseTitle> <xsl:value-of select="$title" /> </courseTitle> </xsl:template> </xsl:stylesheet>
Revision: 28407
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 8, 2010 03:03 by davidjohnevans
Initial Code
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <courseTitles> <xsl:apply-templates select="//SortPrefixAndTitle"> <xsl:sort select="substring-before(.,'|')"> </xsl:sort> </xsl:apply-templates> </courseTitles> </xsl:template> <xsl:template match="SortPrefixAndTitle"> <xsl:variable name="title" select="substring-after(.,'|')" /> <courseTitle> <xsl:value-of select="$title" /> </courseTitle> </xsl:template> </xsl:stylesheet>
Initial URL
xsl-sort-substrings
Initial Description
Initial Title
Using xsl:sort to sort output nodes by substrings
Initial Tags
sort
Initial Language
XSLT