⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 value-of.xtp

📁 resinweb服务器源文件
💻 XTP
字号:
<s1 title="XSL value-of"><p>Often, stylesheets need to grab data from the XML file and rearrangethem in the template results.  The previous examples used template matchingfor all processing, but couldn't grab data within the template pattern.<var/xsl:value-of/> is the main XSL element to grab data from the XML.<p><var/xsl:value-of/> extracts data with an XPath<var/select/> expression.  <var/select/> and the template's <var/match/>pattern use the same syntax, but are used differently.  For a matchpattern, XSL has a current node and chooses the best matching pattern andits template.  With a select pattern, XSL starts from a node and selectsstrings, numbers, or nodes from that node.<p>The following example uses xsl:value-of to extract the <var/@name/>attribute to customize the message.  The xsl:value-of adds textto the output.</p><example title='default.xsl'>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;xsl:template match="hello">  &lt;xsl:text>Hello, &lt;/xsl:text>  &lt;xsl:value-of select="@name"/>&lt;/xsl:template>&lt;/xsl:stylesheet></example><p>As the following XTP file shows, using xsl:value-of with XMLattributes gives more power to the custom tags.</p><example title='hello.xtp'>Tag attributes: &lt;hello name="Dolly"/></example><results>Tag attributes: Hello, Dolly</results><s2 title="StyleScript"><p>Because xsl:value-of is so common, StyleScript has a special syntaxfor it.  $(<var/select/>) will write the text value of the selectpattern to the output.</p><example title='default.xsl'>$template(hello) &lt;&lt;Hello, $(@text)>></example></s2><s2 title="Summary"><ul><li>The XPath pattern <var/@attr/> matches tag attributes.<li><var/xsl:value-of/> extracts values from the XML.<li><var/&lt;&lt; ... >>/> trims initial and final linefeeds.<li><var/$(...)/> expands to <var/&lt;xsl:value-of select="..."/&gt;/></ul></s2></s1>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -