June 2008
Intermediate to advanced
986 pages
27h 8m
English
[2.0] <xsl:sequence>
Creates a sequence of nodes and/or atomic values.
Instruction.
selectAn XPath expression that determines the content of the sequence.
None.
Zero or more <xsl:fallback> elements. The <xsl:fallback> element specifies
processing that should take place in the case of an element that the
XSLT processor doesn’t support. They are most commonly written for
XSLT 1.0 processors operating in forwards-compatible mode.
A template.
XSLT section 11.10, “Constructing Sequences.”
We’ll use a simple example here that creates a sequence inside
an <xsl:variable>. Here’s the
stylesheet:
<?xml version="1.0" encoding="utf-8"?> <!-- sequence.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:variable name="sales" as="xs:integer*"> <xsl:for-each select="/report/brand/units"> <xsl:if test=". > 10000"> <xsl:sequence select="."/> </xsl:if> </xsl:for-each> </xsl:variable> <xsl:value-of select="/report/title"/> <xsl:text>

Sales figures: </xsl:text> <xsl:value-of select="$sales" separator=", "/> <xsl:text>

Sequence total: 	</xsl:text> <xsl:value-of select="format-number(sum($sales), '$#,###.00')"/> <xsl:text>
Sequence average:	</xsl:text> <xsl:value-of select="format-number(avg($sales), '$#,###.00')"/> </xsl:template> </xsl:stylesheet>
Inside the
Read now
Unlock full access