Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 2

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.

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELID398994
img
Uploaded by :
gx969x11
Page 1 Preview
when variable defined the stylesheet level
Sell Your Old Documents & Earn Wallet Balance