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

📄 filter-attribute.xtp

📁 resinweb服务器源文件
💻 XTP
字号:
<s1 title="Default Attributes with Filter Patterns"><p>XPath filter patterns can simplify default attributes.  Instead of usingsome sort of <var/if/> pattern, an XPath pattern can match elements witha specific attribute.  In the CSS class attribute example, thestylesheet can have separate templates for an example with a classattribute and one without it.<p>An XPath filter looks like <var/foo/>[<var/test/>].  The testexpression is evaluated with <var/foo/> as the context node.  Thefollowing example uses <var/example/>[<var/@class/>] to match onlyexamples with class attributes.<p>The test expression can be any XPath expression.  If it's a nodeexpression like @class, the filter will match if it can select anymatching node.</p><example title='default.xsl'>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;xsl:template match="example">  &lt;table class="example">    &lt;tr>      &lt;td>        &lt;xsl:apply-templates/>      &lt;/td>    &lt;/tr>  &lt;/table>&lt;/xsl:template>&lt;xsl:template match="example[@class]">  &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>In the example stylesheet, an &lt;example> tag will match thesecond template if it has a class attribute.  It will match the firsttemplate if it has no class attribute.<p>The example XTP does not specify class, so the stylesheet willuse "example" as the default class.</p><example title='hello.xtp'>&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><s2 title="Summary"><ul><li><var/foo/>[<var/test/>] is an XPath filter pattern.<li>Filter patterns match both the path and the filter expression.<li>If the filter is a selection path, it matches if it selects any node.</ul></s2></s1>

⌨️ 快捷键说明

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