📄 xtp-copy.xtp
字号:
<s1 title="XTP Identity"><p>XTP (XML template pages) lets you ease into XML and XSLT(XML Stylesheet Tranformations). Your Serif pages can be almost identical toJSP pages and just use XSLT to eliminate repetitious error-prone patterns.</p><p>XTP transforms XML or HTML documents into a XML or HTML output. Inother words, it's an XML transformation. So each XTP page has four parts:</p><ol><li>The input XML (the XTP file)<li>The transformation stylesheet (the XSL file)<li>The generated JSP<li>The generated output (the result of executing the JSP)</ol><p>The easiest transformation is the identity transformation. The followingstylesheet copies the input into the output.</p><example title="default.xsl"><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- make sure '<' is not printed as '&lt;' --> <xsl:output disable-output-escaping='true'/> <!-- copy input to output --> <xsl:template match='*|@*'> <xsl:copy> <xsl:apply-templates select='node()|@*'/> </xsl:copy> </xsl:template></xsl:stylesheet></example><p>Each <var/template/> contains a <var/match/> pattern and a<var/replacement tree/>. The match pattern is an <var/XPath/> expression.In the above example, the match pattern <var/*|@*/> matches any elementand any attribute. The replacement <var/xsl:copy/> copies the currentnode and calls <var/xsl:apply-templates/> to recursively evaluateany children of the current node.</p><p>You can put <var/default.xsl/> in the same directory as the xtpfile, or you can put in WEB-INF/xsl, or you can put it in theclasspath like WEB-INF/classes. The last option is useful if you wantto create a jar of useful stylesheets and beans. </p><p>Your XTP page may look something like:</p><example title='test.xtp'><h1>My test</h1>Adding: 2 + 2 = <%= 2 + 2 %></example><p>The generated JSP is identical to the input, and the generated HTMLjust executes the JSP.</p><results><h1>My test</h1>Adding: 2 + 2 = 4</results></s1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -