Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
when variable defined the stylesheet level

When variable defined the stylesheet level

332

Chapter 13

Table 13.28
xsl:processing-instruction

xsl:stylesheet

xsl:if

xsl:variable

xsl:processing-instruction

Variable Examples

The xsl:variable is typically used to grab information from the source XML that will be reused repeatedly throughout the stylesheet or to store information. Once you grab the information, you can use it again and again by referencing the variable name with a $ prefix, as in $variable_name. Avariable’s value is set as part of its definition, making it quite different from the variables you use in other programming languages. Those variables must be defined and their value must be changed many times over the life of the programs in which they are found. In this way, variables act like constants.

xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>

<xsl:variable name=”row_num” select=”0”/>

XSLT In-Depth 333

</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

The results of this example are shown in Figure 13.3. The first time $row_num is referenced, it takes the value of the stylesheet-level row_num variable because no template-body-level $row_num exists at that point. The second time it is referenced, it takes the value of the attribute “num” of the current row.

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Amanda Hayes

PageId: ELID398994