only for RuBoard |
xsl:value-of inserts the value of the selected node as text.
Attribute Name | Enforced | Description | Values |
---|---|---|---|
select | Required | Expression to be evaluated against the current context. The results are converted to a string. | Expression |
disable-output- escaping | Optional | Determines if the result element should no longer be escaped. The default is no . | yes or no |
Consider the following XML file, links.xml :
<?xml version="1.0" encoding="UTF-8" ?> <links> <link name="NewRiders.com" URL="http://www.newriders.com" /> <link name="Xmlandasp.net" URL="http://www.xmlandasp.net" /> <link name="MSDN Online Library" URL="http://msdn.microsoft.com/library" /> </links>
The following stylesheet can be applied to the XML file to generate brackets around each of the values specified:
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <table> <xsl:for-each select="links/link"> <tr> <td> <xsl:value-of select="@name" /> </td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet>
This yields the following result:
<?xml version="1.0" encoding="UTF-16"?> <table><tr><td>NewRiders.com</td></tr><tr><td>Xmlandasp.net</td></tr><tr><td>MSDN Online Library</td></tr></table>
If the select attribute's value yields more than one node in the result tree, only the first result node is returned. If the node has substructure , the child structure is concatenated to the result with markup removed. For example, consider the following XML document:
<?xml version="1.0" encoding="utf-8" ?> <paragraph> <sentence>Click <href URL="http://msdn.microsoft.com">here</href> for the MSDN library.</sentence> <sentence>This is another sentence.</sentence> <sentence>This is yet another sentence.</sentence> </paragraph>
A stylesheet can be applied to this document that selects all sentence nodes:
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:value-of select="paragraph/sentence" /> </xsl:template> </xsl:stylesheet>
Because more than one sentence node is returned by the select attribute, only the first is included in the result tree. Because the selected node has substructure, its child structure is also included in the result tree with markup removed:
<?xml version="1.0" encoding="UTF-16"?>Click here for the MSDN library.
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements
None.
only for RuBoard |