short-attribute.xtp

来自「解压在c盘」· XTP 代码 · 共 52 行

XTP
52
字号
<s1 title="Attribute Value Templates"><p>Because calculating attributes is very common, the XSLT standardadds a special syntax for attribute value templates.A stylesheet can uses an attribute value template to calculatethe template value for the element directly.  Curly brackets introducea value-of expression, e.g. "{@class}".  The following stylesheetis a direct translation of the previous example.</p><example title='default.xsl'>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;xsl:template match="box">  &lt;table class="{@class}">    &lt;tr>      &lt;td>        &lt;xsl:apply-templates/>      &lt;/td>    &lt;/tr>  &lt;/table>&lt;/xsl:template>&lt;/xsl:stylesheet></example><p>The example XTP and its generated HTML is identical to the previous examplesince attribute value templates are just a syntactic shortcut.</p><example title='hello.xtp'><example>&lt;example>This is an example.&lt;/example></example><results>&lt;table class="example">&lt;tr>  &lt;td>This is an example&lt;/td>&lt;/tr>&lt;/table></results></example><s2 title="Summary"><ul><li><var/"{...}"/> interpolates an attribute's value.</ul></s2></s1>

⌨️ 快捷键说明

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