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

📄 apply-templates.xtp

📁 resinweb服务器源文件
💻 XTP
字号:
<s1 title="xsl:apply-templates"><p>Most stylesheet templates generate HTML elements with content.The previous Hello, World example just replaced an empty tag &lt;hello>with some text.  Any content of the &lt;hello> tag was ignored.XSL uses &lt;xsl:apply-templates> to evaluate the children of an element.<p>The following stylesheet creates a &lt;note> tag whose content isevaluated using the normal XSL processing.  In the example,every &lt;note> tag is replaced with "Note: " and emphasizes thecontents of the tag.</p><example title='default.xsl'>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;xsl:template match="note">  &lt;xsl:text>Note: &lt;/xsl:text>  &lt;em>    &lt;xsl:apply-templates/>  &lt;/em>&lt;/xsl:template>&lt;xsl:template match="hello">  &lt;xsl:text>Hello, World!&lt;/xsl:text>&lt;/xsl:template>&lt;/xsl:stylesheet></example><p>Since the XSL engine will evaluate the contents of the &lt;note>,it will replace the &lt;hello> from the previous example withthe "Hello, World" text.  By creating tags like &lt;note>, you canchange the look of a page or an entire site by changing the stylesheet.All the &lt;note> instances will be automatically reformatted.  With Serif,you can modify the stylesheet and immediately browse the site to see howit looks.  The feedback is immediate.</p><example title='hello.xtp'>This is a plain, old description.&lt;note>The first example is &lt;hello/>&lt;/note></example><results>This is a plain, old description.Note: &lt;em>The first example is Hello, world!&lt;/em></results><s2 title="StyleScript equivalent"><p>The StyleScript equivalent is <var/$apply-templates();/>.  The functionnotation, $<var/foo/>() expands to an xsl:<var/foo/> element.  The&nbsp;';'tells StyleScript that the tag is empty.  For a tag with contents, use <var/&lt;&lt;...>>/>.</p><example title='default.xsl'>$template(note) &lt;&lt;Note: &lt;em>$apply-templates();&lt;/em>>>$template(hello) &lt;&lt;Hello, World!>></example></s2><s2 title="Summary"><ul><li><var/xsl:apply-templates/> processes the current node's children.<li>You can add tags, like <var/&lt;em>/>, directly to the stylesheet.<li><var/$apply-templates();/> expands to <var/&lt;xsl:apply-templates/&gt;/></ul></s2></s1>

⌨️ 快捷键说明

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