Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <root>
- <isSequence>
- <seq name="a" value="1, 2, 3"/>
- <seq name="b" value="3, 1, 5, 6"/>
- <seq name="c" value="15, 16, 18, 0"/>
- <seq name="d" value="21, 22, 23, 24, 25"/>
- <seq name="e" value="A, B, C"/>
- </isSequence>
- </root>
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- exclude-result-prefixes="xs"
- version="2.0">
- <xsl:template match="/">
- <xsl:for-each select="root/isSequence/seq">
- <xsl:if test="subsequence(@value, 0)">
- <xsl:value-of select="@name"/> is an ascending numeric sequence
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
- </xsl:stylesheet>
- a is an ascending numeric sequence
- d is an ascending numeric sequence
- <xsl:template match="seq[let $items := tokenize(@value, ',s+')!xs:integer(.) return every $p in 1 to count($items) satisfies $items[$p] = $items[1] + ($p - 1)]">
- <xsl:value-of select="@name"/><xsl:text> is an ascending numeric sequence
- </xsl:text>
- </xsl:template>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- exclude-result-prefixes="#all"
- expand-text="yes"
- version="3.0">
- <xsl:mode on-no-match="shallow-skip"/>
- <xsl:strip-space elements="*"/>
- <xsl:output method="text"/>
- <xsl:template match="seq[let $items := tokenize(@value, ',s+')!xs:integer(.) return every $p in 1 to count($items) satisfies $items[$p] = $items[1] + ($p - 1)]">
- <xsl:value-of select="@name"/><xsl:text> is an ascending numeric sequence
- </xsl:text>
- </xsl:template>
- </xsl:stylesheet>
Add Comment
Please, Sign In to add comment