|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: number collapsing
range.xml <a> <r><x>1</x><x>3</x><x>5</x><x>7</x></r> <r><x>1</x><x>2</x><x>3</x><x>4</x></r> <r><x>1</x><x>2</x><x>3</x><x>8</x></r> </a> range.xsl <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="r"> <xsl:text> [</xsl:text> <xsl:for-each-group select="x" group-adjacent="if (position()=1 or .=preceding-sibling::x[1]+1) then -1 else position() "> <xsl:value-of select="."/> <xsl:if test="current-group()[2]"> <xsl:text>-</xsl:text> <xsl:value-of select="current-group()[last()]"/> </xsl:if> <xsl:if test="position()!=last()">,</xsl:if> </xsl:for-each-group> <xsl:text>]</xsl:text> </xsl:template> </xsl:stylesheet> $ java -jar ../saxon8/saxon8.jar range.xml range.xsl <?xml version="1.0" encoding="UTF-8"?> [1,3,5,7] [1-4] [1-3,8] ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








