Wednesday, February 18, 2026

XSLT Value-of

 

<xsl:value-of> Element

The <xsl:value-of> element specifies the value of an XML element to be copied to the resultant document. 

The syntax for the <xsl:value-of> element is:

<xsl:value-of select =Expression separator = { String } disable-output-escaping ="yes | no"/>

In the above syntax:

  • select: Retrieves the result of the expression and displays it in the resultant document. While displaying the output of the expression, the value is converted to a string format. Table 4-2 lists the action of the <xsl:value-of> element based on the value of the expression in the select attribute:

Value of the Expression in the Select Attribute

Action of the <xsl:value-of> Element

Boolean value

Converts the Boolean value to a string value, such as true or false.

Node-set

Provides the value as output to the resultant document depending on the type of nodes in node-set.

Numeric value

Converts the numeric value to the string format using the <xsl:number> element or the format-number() function.



  • separator: Refers to a separator character for the values in the select attributes. The value specified in the separator concatenates the values specified in the select attribute. For example, in the following code, the asterisk character is the separator that concatenates the values a, b, c, and d of the select attribute: 

  • <customer><xsl:value-of select ="(a, b, c, d)" separator ="*"/><customer/>

The output of the above code is:

<customer>a*b*c*d</customer>
  • disable-output-escaping: Contains the value, yes or no. If the value is no, special characters such as < and > are specified as &lt, and &gt, respectively. This is the default value. If the value of the disable-output-escaping is yes, the attribute enables you to use characters, such as < and >.

  • You can use the <xsl:value-of> element in the following formats:

    • <xsl:value-of select ="//@currency"/>: Displays the value of the attribute currency in the resultant document.

    • <xsl:value-of select ="child::*"/>: Copies all the child nodes of the current node into the resultant document.

    • <xsl:value-of select ="sum(//balance)"/>: Specifies XPath functions, such as floor(), sum(), concat(), and translate() to display the sum of a node called balance.

No comments:

Post a Comment

SOA Overview Part-1

  Middleware It provides a mechanism for the process to interact with other processes running on multiple network machines. Advantages...