You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
621 lines
25 KiB
621 lines
25 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta name="generator" content=
|
|
"HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.3.6), see www.w3.org" />
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=utf-8" />
|
|
<title>Document Templating Steps for XProc</title>
|
|
<link rel="alternate" title="XML" href="xproc-template.xml" />
|
|
<link rel="alternate" title="Latest editor's draft" href=
|
|
"http://www.w3.org/XML/XProc/docs/langspec.html" />
|
|
<link rel="alternate" title="Latest Public Working Draft" href=
|
|
"http://www.w3.org/TR/xproc/" />
|
|
<link rel="stylesheet" type="text/css" href=
|
|
"http://www.w3.org/StyleSheets/TR/base.css" />
|
|
<link rel="stylesheet" type="text/css" href="xproc.css" />
|
|
<link rel="stylesheet" type="text/css" href=
|
|
"http://www.w3.org/StyleSheets/TR/W3C-WG-NOTE.css" />
|
|
</head>
|
|
<body>
|
|
<div class="specification">
|
|
<div class="head" id="spec.head">
|
|
<p><a href="http://www.w3.org/"><img height="48" width="72" alt=
|
|
"W3C" src="http://www.w3.org/Icons/w3c_home" /></a></p>
|
|
<h1>Document Templating Steps for XProc</h1>
|
|
<h2>W3C Working Group Note 25 January 2011</h2>
|
|
<dl>
|
|
<dt>This Version:</dt>
|
|
<dd><a href=
|
|
"http://www.w3.org/TR/2011/NOTE-xproc-template-20110125/">http://www.w3.org/TR/2011/NOTE-xproc-template-20110125/</a></dd>
|
|
<dt>Latest Version:</dt>
|
|
<dd><a href=
|
|
"http://www.w3.org/TR/xproc-template/">http://www.w3.org/TR/xproc-template/</a></dd>
|
|
<dt>Editor:</dt>
|
|
<dd><span class="personname">Norman Walsh</span>, <span class=
|
|
"orgname">MarkLogic Corporation</span> <tt class=
|
|
"email"><<a href=
|
|
"mailto:norman.walsh@marklogic.com">norman.walsh@marklogic.com</a>></tt></dd>
|
|
</dl>
|
|
<p>This document is also available in these non-normative formats:
|
|
<a href="xproc-template.xml">XML</a></p>
|
|
<p class="copyright"><a href=
|
|
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
|
|
© 2011 <a href="http://www.w3.org/"><acronym title=
|
|
"World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href=
|
|
"http://www.csail.mit.edu/"><acronym title=
|
|
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
|
|
"http://www.ercim.org/"><acronym title=
|
|
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
|
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
|
|
W3C <a href=
|
|
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
|
<a href=
|
|
"http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
|
|
and <a href=
|
|
"http://www.w3.org/Consortium/Legal/copyright-documents">document
|
|
use</a> rules apply.</p>
|
|
<hr />
|
|
<div class="abstract">
|
|
<h2>Abstract</h2>
|
|
<p>This note describes two new XProc steps designed to make it
|
|
easier to construct documents within an XProc pipeline using values
|
|
computed by that pipeline.</p>
|
|
</div>
|
|
<div class="status">
|
|
<h2>Status of this Document</h2>
|
|
<p><em>This section describes the status of this document at the
|
|
time of its publication. Other documents may supersede this
|
|
document. A list of current W3C publications and the latest
|
|
revision of this technical report can be found in the <a href=
|
|
"http://www.w3.org/TR/">W3C technical reports index</a> at
|
|
http://www.w3.org/TR/.</em></p>
|
|
<p>This is the first publication of this document as a Working
|
|
Group Note. This document is a product of the <a href=
|
|
"http://www.w3.org/XML/Processing/">XML Processing Model Working
|
|
Group</a> as part of the W3C <a href=
|
|
"http://www.w3.org/XML/Activity">XML Activity</a>. The English
|
|
version of this specification is the only normative version.
|
|
However, for translations of this document, see <a href=
|
|
"http://www.w3.org/2003/03/Translations/byTechnology?technology=xproc-template">
|
|
http://www.w3.org/2003/03/Translations/byTechnology?technology=xproc-template</a>.</p>
|
|
<p>This Note defines some additional optional steps for use in
|
|
XProc pipelines. The XML Processing Model Working Group expects
|
|
that these new steps will be widely implemented and used.</p>
|
|
<p>Please report errors in this document to the public mailing list
|
|
<a href=
|
|
"mailto:public-xml-processing-model-comments@w3.org">public-xml-processing-model-comments@w3.org</a>
|
|
(public <a href=
|
|
"http://lists.w3.org/Archives/Public/public-xml-processing-model-comments/">
|
|
archives</a> are available).</p>
|
|
<p>Publication as a Working Group Note does not imply endorsement
|
|
by the W3C Membership. This is a draft document and may be updated,
|
|
replaced or obsoleted by other documents at any time. It is
|
|
inappropriate to cite this document as other than work in
|
|
progress.</p>
|
|
<p>This document was produced by a group operating under the
|
|
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
|
|
February 2004 W3C Patent Policy</a>. W3C maintains a <a href=
|
|
"http://www.w3.org/2004/01/pp-impl/38398/status">public list of any
|
|
patent disclosures</a> made in connection with the deliverables of
|
|
the group; that page also includes instructions for disclosing a
|
|
patent. An individual who has actual knowledge of a patent which
|
|
the individual believes contains <a href=
|
|
"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
|
|
Essential Claim(s)</a> must disclose the information in accordance
|
|
with <a href=
|
|
"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
|
|
section 6 of the W3C Patent Policy</a>.</p>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div id="spectoc">
|
|
<div class="toc">
|
|
<h2 id="TableOfContents">Table of Contents</h2>
|
|
<dl class="toc">
|
|
<dt><span>1 <a href=
|
|
"#introduction">Introduction</a></span></dt>
|
|
<dt><span>2 <a href="#terminology">Terminology</a></span></dt>
|
|
<dt><span class="ext-optional">3 <a href=
|
|
"#c.in-scope-names">p:in-scope-names</a></span></dt>
|
|
<dt><span class="ext-optional">4 <a href=
|
|
"#c.template">p:template</a></span></dt>
|
|
</dl>
|
|
</div>
|
|
<h3><a name="appendices" id="appendices"></a>Appendices</h3>
|
|
<div class="toc">
|
|
<dl class="toc">
|
|
<dt><span>A <a href="#references">References</a></span></dt>
|
|
<dd>
|
|
<dl class="toc">
|
|
<dt><span>A.1 <a href="#normative-references">Normative
|
|
References</a></span></dt>
|
|
</dl>
|
|
</dd>
|
|
<dt><span>B <a href="#errors-list">List of Error
|
|
Codes</a></span></dt>
|
|
<dd>
|
|
<dl class="toc">
|
|
<dt><span>B.1 <a href="#app.step-errors">Step
|
|
Errors</a></span></dt>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="section">
|
|
<h3><a name="introduction" id=
|
|
"introduction"></a>1 Introduction</h3>
|
|
<p>It's quite common in [<a href="#xproc"><span class=
|
|
"abbrev">XProc: An XML Pipeline Language</span></a>] to construct
|
|
documents using values computed by the pipeline. This is
|
|
particularly (but not exclusively) the case when the pipeline uses
|
|
the <tt class="tag-element">p:http-request</tt> step. The input to
|
|
<tt class="tag-element">p:http-request</tt> is a <tt class=
|
|
"tag-element">c:request</tt> document; attributes on the <tt class=
|
|
"tag-element">c:request</tt> element control most of the request
|
|
parameters; the body of the document forms the body of request.</p>
|
|
<p>A typical example looks like this:</p>
|
|
<div class="programlisting">
|
|
<pre>
|
|
<c:request method="POST" href="http://example.com/post"
|
|
username="user" password="password">
|
|
<c:body>
|
|
<computed-content/>
|
|
</c:body>
|
|
</c:request>
|
|
</pre></div>
|
|
<p>If we assume that the <tt class="tag-attribute">href</tt> value
|
|
and the computed content come from an input document, and the
|
|
username and password are options, then a typical pipeline to
|
|
compute the request becomes quite complex.</p>
|
|
<div class="programlisting">
|
|
<pre>
|
|
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc"
|
|
xmlns:c="http://www.w3.org/ns/xproc-step"
|
|
name="main" version="1.0">
|
|
<p:option name="username" required="true"/>
|
|
<p:option name="password" required="true"/>
|
|
|
|
<p:identity>
|
|
<p:input port="source">
|
|
<p:inline>
|
|
<c:request method="POST"/>
|
|
</p:inline>
|
|
</p:input>
|
|
</p:identity>
|
|
|
|
<p:add-attribute match="/c:request" attribute-name="href">
|
|
<p:with-option name="attribute-value" select="/doc/request/@uri">
|
|
<p:pipe step="main" port="source"/>
|
|
</p:with-option>
|
|
</p:add-attribute>
|
|
|
|
<p:add-attribute match="/c:request" attribute-name="username">
|
|
<p:with-option name="attribute-value" select="$username"/>
|
|
</p:add-attribute>
|
|
|
|
<p:add-attribute match="/c:request" attribute-name="password">
|
|
<p:with-option name="attribute-value" select="$password"/>
|
|
</p:add-attribute>
|
|
|
|
<p:insert position="first-child" match="/c:request">
|
|
<p:input port="insertion" select="/doc/request">
|
|
<p:pipe step="main" port="source"/>
|
|
</p:input>
|
|
</p:insert>
|
|
|
|
<p:unwrap match="/c:request/request"/>
|
|
|
|
</p:pipeline>
|
|
</pre></div>
|
|
<p>There's nothing wrong with this pipeline, but it requires
|
|
several steps to accomplish with the pipeline author probably
|
|
considers a single operation. What's more, the result of these
|
|
steps is not immediately obvious on casual inspection.</p>
|
|
<p>In order to make this simple construction case both literally
|
|
and conceptually simpler, this note introduces two new XProc steps
|
|
in the XProc namespace. Support for these steps is optional, but we
|
|
strongly encourage implementors to provide them.</p>
|
|
<p>The new steps are <a href="#c.in-scope-names"><tt class=
|
|
"tag-element">p:in-scope-names</tt></a> and <a href=
|
|
"#c.template"><tt class="tag-element">p:template</tt></a>. Taken
|
|
together, they greatly simplify the pipeline:</p>
|
|
<div class="programlisting">
|
|
<pre>
|
|
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc"
|
|
xmlns:c="http://www.w3.org/ns/xproc-step"
|
|
name="main" version="1.0">
|
|
<p:option name="username" required="true"/>
|
|
<p:option name="password" required="true"/>
|
|
|
|
<p:in-scope-names name="vars"/>
|
|
|
|
<p:template>
|
|
<p:input port="template">
|
|
<p:inline>
|
|
<c:request method="POST" href="{/doc/request/@uri}"
|
|
username="{$username}" password="{$password}">
|
|
{ /doc/request/node() }
|
|
</c:request>
|
|
</p:inline>
|
|
</p:input>
|
|
<p:input port="source">
|
|
<p:pipe step="main" port="source"/>
|
|
</p:input>
|
|
<p:input port="parameters">
|
|
<p:pipe step="vars" port="result"/>
|
|
</p:input>
|
|
</p:template>
|
|
|
|
</p:pipeline>
|
|
</pre></div>
|
|
<p>The <a href="#c.in-scope-names"><tt class=
|
|
"tag-element">p:in-scope-names</tt></a> step provides all of the
|
|
in-scope options and variables in a <tt class=
|
|
"tag-element">c:param-set</tt> (this operation is exactly analagous
|
|
to what the <tt class="tag-element">p:parameters</tt> step does,
|
|
except that it operates on the options and variables instead of on
|
|
parameters).</p>
|
|
<p>The <a href="#c.template"><tt class=
|
|
"tag-element">p:template</tt></a> step searches for XPath
|
|
expressions, delimited by curly braces, in a template document and
|
|
replaces each with the result of evaluating the expression. All of
|
|
the parameters passed to the <a href="#c.template"><tt class=
|
|
"tag-element">p:template</tt></a> step are available as in-scope
|
|
variable names when evaluating each XPath expression.</p>
|
|
<p>Where the expressions occur in attribute values, their string
|
|
value is used. Where they appear in text content, their node values
|
|
are used.</p>
|
|
</div>
|
|
<div class="section">
|
|
<h3><a name="terminology" id=
|
|
"terminology"></a>2 Terminology</h3>
|
|
<p>In this note the words <span class="rfc2119">must</span>,
|
|
<span class="rfc2119">must not</span>, <span class=
|
|
"rfc2119">should</span>, <span class="rfc2119">should not</span>,
|
|
<span class="rfc2119">may</span> and <span class=
|
|
"rfc2119">recommended</span> are to be interpreted as described in
|
|
[<a href="#rfc2119"><span class="abbrev">RFC 2119</span></a>].</p>
|
|
</div>
|
|
<div class="section">
|
|
<h3><a name="c.in-scope-names" id=
|
|
"c.in-scope-names"></a>3 p:in-scope-names</h3>
|
|
<p>The <tt class="code">p:in-scope-names</tt> step exposes all of
|
|
the in-scope variables and options as a set of parameters in a
|
|
<tt class="tag-element">c:param-set</tt> document.</p>
|
|
<p class="element-syntax element-syntax-declare-step-opt">
|
|
<span class="decl"><code><p:declare-step</code> <code class=
|
|
"attr type-attr">type</code><code>="</code><code class=
|
|
"value type-value">p:in-scope-names</code><code>"</code><code>></code></span><br />
|
|
|
|
     <span class=
|
|
"input"><code><p:output</code> <code class=
|
|
"attr port-attr">port</code><code>="</code><code class=
|
|
"value port-value">result</code><code>"</code> <code class=
|
|
"attr primary-attr">primary</code><code>="</code><code class=
|
|
"value primary-value">false</code><code>"</code><code>/></code></span><br />
|
|
|
|
<code></p:declare-step></code></p>
|
|
<p>Each in-scope variable and option is converted into a <tt class=
|
|
"tag-element">c:param</tt> element. The resulting <tt class=
|
|
"tag-element">c:param</tt> elements are wrapped in a <tt class=
|
|
"tag-element">c:param-set</tt> and the parameter set document is
|
|
written to the <tt class="port">result</tt> port. <a name="impl-1"
|
|
id="impl-1"></a>The order in which <tt class=
|
|
"tag-element">c:param</tt> elements occur in the <tt class=
|
|
"tag-element">c:param-set</tt> is <em class=
|
|
"glossterm">implementation-dependent</em>.</p>
|
|
<p>For consistency and user convenience, if any of the variables or
|
|
options have names that are in a namespace, the <tt class=
|
|
"tag-attribute">namespace</tt> attribute on the <tt class=
|
|
"tag-element">c:param</tt> element <span class=
|
|
"rfc2119">must</span> be used. Each <tt class=
|
|
"tag-attribute">name</tt> <span class="rfc2119">must</span> be an
|
|
NCName.</p>
|
|
<p>The base URI of the output document is the URI of the pipeline
|
|
document that contains the step.</p>
|
|
<p>For consistency with the <tt class=
|
|
"tag-element">p:parameters</tt> step, the <tt class=
|
|
"port">result</tt> port is not primary.</p>
|
|
<div class="section">
|
|
<h4><a name="ex-in-scope-names" id=
|
|
"ex-in-scope-names"></a>3.1 Example</h4>
|
|
<p>This unlikely pipeline demonstrates the behavior of <a href=
|
|
"#c.in-scope-names"><tt class=
|
|
"tag-element">p:in-scope-names</tt></a>:</p>
|
|
<div class="programlisting">
|
|
<pre>
|
|
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
|
|
name="main" version="1.0">
|
|
<p:output port="result">
|
|
<p:pipe step="vars" port="result"/>
|
|
</p:output>
|
|
|
|
<p:option name="username" required="true"/>
|
|
<p:option name="password" required="true"/>
|
|
<p:variable name="host" select="'http://example.com/'"/>
|
|
|
|
<p:in-scope-names name="vars"/>
|
|
|
|
</p:declare-step>
|
|
</pre></div>
|
|
<p>Assuming the values supplied for the username and password
|
|
options are “<tt class="literal">user</tt>” and “<tt class=
|
|
"literal">pass</tt>”, respectively, the output would be:</p>
|
|
<div class="programlisting">
|
|
<pre>
|
|
<c:param-set xmlns:c="http://www.w3.org/ns/xproc-step">
|
|
<c:param name="username" namespace="" value="user"/>
|
|
<c:param name="host" namespace="" value="http://example.com/"/>
|
|
<c:param name="password" namespace="" value="pass"/>
|
|
</c:param-set>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section">
|
|
<h3><a name="c.template" id="c.template"></a>4 p:template</h3>
|
|
<p>The <tt class="code">p:template</tt> replaces each XPath
|
|
expression, delimited with curly braces, in the <tt class=
|
|
"port">template</tt> document with the result of evaluating that
|
|
expression.</p>
|
|
<p class="element-syntax element-syntax-declare-step-opt">
|
|
<span class="decl"><code><p:declare-step</code> <code class=
|
|
"attr type-attr">type</code><code>="</code><code class=
|
|
"value type-value">p:template</code><code>"</code><code>></code></span><br />
|
|
|
|
     <span class=
|
|
"input"><code><p:input</code> <code class=
|
|
"attr port-attr">port</code><code>="</code><code class=
|
|
"value port-value">template</code><code>"</code><code>/></code></span><br />
|
|
|
|
     <span class=
|
|
"input"><code><p:input</code> <code class=
|
|
"attr port-attr">port</code><code>="</code><code class=
|
|
"value port-value">source</code><code>"</code> <code class=
|
|
"attr sequence-attr">sequence</code><code>="</code><code class=
|
|
"value sequence-value">true</code><code>"</code> <code class=
|
|
"attr primary-attr">primary</code><code>="</code><code class=
|
|
"value primary-value">true</code><code>"</code><code>/></code></span><br />
|
|
|
|
     <span class=
|
|
"input"><code><p:input</code> <code class=
|
|
"attr port-attr">port</code><code>="</code><code class=
|
|
"value port-value">parameters</code><code>"</code> <code class=
|
|
"attr kind-attr">kind</code><code>="</code><code class=
|
|
"value kind-value">parameter</code><code>"</code><code>/></code></span><br />
|
|
|
|
     <span class=
|
|
"input"><code><p:output</code> <code class=
|
|
"attr port-attr">port</code><code>="</code><code class=
|
|
"value port-value">result</code><code>"</code><code>/></code></span><br />
|
|
|
|
<code></p:declare-step></code></p>
|
|
<p>While evaluating each expression, the names of any parameters
|
|
passed to the step are available as variable values in the XPath
|
|
dynamic context.</p>
|
|
<p>The step searches for XPath expressions in attribute values,
|
|
text content (adjacent text nodes, if they occur in the data model,
|
|
must be coalesced; this step always processes maximal length text
|
|
nodes), processing instruction data, and comments. XPath
|
|
expressions are identified by curly braces, similar to attribute
|
|
value templates in XSLT or enclosed expressions in XQuery.</p>
|
|
<p>In order to allow curly braces to appear literally in content,
|
|
they can be escaped by doubling them. In other words, where
|
|
“<tt class="code">{</tt>” would start an XPath expression,
|
|
“<tt class="code">{{</tt>” is simply a <em>single</em>, literal
|
|
opening curly brace. The same applies for closing curly braces.</p>
|
|
<p>Inside an XPath expression, strings quoted by single (<tt class=
|
|
"code">'</tt>) or double (<tt class="code">"</tt>) quotes are
|
|
treated literally. Outside of quoted text, it is an error for an
|
|
opening curly brace to occur. A closing curly brace ends the XPath
|
|
expression (whether or not it is followed immediately by another
|
|
closing curly brace).</p>
|
|
<p>These parsing rules can be described by the following algorithm,
|
|
though implementations are by no means required to implement the
|
|
parsing in exactly this way, provided that they achieve the same
|
|
results.</p>
|
|
<div class="itemizedlist">
|
|
<ul>
|
|
<li>
|
|
<p>The parser begins in <em>regular-mode</em> at the start of each
|
|
unit of content where expansion may occur. In
|
|
<em>regular-mode</em>:</p>
|
|
<div class="orderedlist">
|
|
<ol style="list-style: decimal;">
|
|
<li>
|
|
<p>“<tt class="code">{{</tt>” is replaced by a single “<tt class=
|
|
"code">{</tt>”.</p>
|
|
</li>
|
|
<li>
|
|
<p>“<tt class="code">}}</tt>” is replaced by a single “<tt class=
|
|
"code">}</tt>”.</p>
|
|
<p>Note: <a name="err.inline.C0067" id="err.inline.C0067"></a>It is
|
|
a <em class="glossterm">dynamic error</em> (<a href=
|
|
"#err.C0067"><code class="errqname">err:XC0067</code></a>) to
|
|
encounter a single closing curly brace “<tt class="code">}</tt>”
|
|
that is not immediately followed by another closing curly
|
|
brace.</p>
|
|
</li>
|
|
<li>
|
|
<p>A single opening curly brace “<tt class="code">{</tt>” (not
|
|
immediately followed by another opening curly brace) is discarded
|
|
and the parser moves into <em>xpath-mode</em>. The inital
|
|
expression is empty.</p>
|
|
</li>
|
|
<li>
|
|
<p>All other characters are copied without change.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<p>In <em>xpath-mode</em>:</p>
|
|
<div class="orderedlist">
|
|
<ol style="list-style: decimal;">
|
|
<li>
|
|
<p><a name="err.inline.C0067.1" id="err.inline.C0067.1"></a>It is a
|
|
<em class="glossterm">dynamic error</em> (<a href=
|
|
"#err.C0067"><code class="errqname">err:XC0067</code></a>) to
|
|
encounter an opening curly brace “<tt class="code">{</tt>”.</p>
|
|
</li>
|
|
<li>
|
|
<p>A closing curly brace “<tt class="code">}</tt>” is discarded and
|
|
ends the expression. The expression is evaluated and the result of
|
|
that evaluation is copied to the output. The parser returns to
|
|
<em>regular-mode</em>.</p>
|
|
<p>Note: Braces cannot be escaped by doubling them in
|
|
<em>xpath-mode</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>A single quote (<tt class="code">'</tt>) is added to the current
|
|
expression and the parser moves to <em>single-quote-mode</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>A double quote (<tt class="code">"</tt>) is added to the current
|
|
expression and the parser moves to <em>double-quote-mode</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>All other characters are appended to the current expression.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<p>In <em>single-quote-mode</em>:</p>
|
|
<div class="orderedlist">
|
|
<ol style="list-style: decimal;">
|
|
<li>
|
|
<p>A single quote (<tt class="code">'</tt>) is added to the current
|
|
expression and the parser moves to <em>xpath-mode</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>All other characters are appended to the current expression.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<p>In <em>double-quote-mode</em>:</p>
|
|
<div class="orderedlist">
|
|
<ol style="list-style: decimal;">
|
|
<li>
|
|
<p>A double quote (<tt class="code">"</tt>) is added to the current
|
|
expression and the parser moves to <em>xpath-mode</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>All other characters are appended to the current expression.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<p><a name="err.inline.C0067.2" id="err.inline.C0067.2"></a>It is a
|
|
<em class="glossterm">dynamic error</em> (<a href=
|
|
"#err.C0067"><code class="errqname">err:XC0067</code></a>) if the
|
|
parser reaches the end of the unit of content and it is not in
|
|
<em>regular-mode</em>.</p>
|
|
<p>The context node used for each expression is the document passed
|
|
on the <tt class="port">source</tt> port. <a name=
|
|
"err.inline.C0068" id="err.inline.C0068"></a>It is a <em class=
|
|
"glossterm">dynamic error</em> (<a href=
|
|
"#err.C0068"><code class="errqname">err:XC0068</code></a>) if more
|
|
than one document appears on the <tt class="port">source</tt> port.
|
|
In an XPath 1.0 implementation, if <tt class=
|
|
"tag-element">p:empty</tt> is given or implied on the <tt class=
|
|
"port">source</tt> port, an empty document node is used as the
|
|
context node. In an XPath 2.0 implementation, the context item is
|
|
undefined. <a name="err.inline.C0026" id="err.inline.C0026"></a>It
|
|
is a <em class="glossterm">dynamic error</em> (<a href=
|
|
"#err.C0026"><code class="errqname">err:XC0026</code></a>) if any
|
|
XPath expression makes reference to the context node, size, or
|
|
position when the context item is undefined.</p>
|
|
<p>In an attribute value, processing instruction, or comment, the
|
|
string value of the XPath expression is used. In text content, an
|
|
expression that selects nodes will cause those nodes to be copied
|
|
into the template document.</p>
|
|
<div class="admonition">
|
|
<div class="admon-title">Note</div>
|
|
<p>Depending on which version of XPath an implementation supports,
|
|
and possibly on the <tt class="tag-attribute">xpath-version</tt>
|
|
setting on the <tt class="tag-element">p:template</tt>, some
|
|
implementations may report errors, or different results, than other
|
|
implementations in those cases where the interpretation of an XPath
|
|
expression differs between the versions of XPath.</p>
|
|
</div>
|
|
<p>An example of <tt class="tag-element">p:document</tt> appears in
|
|
<a href="#introduction" title="Introduction">Section 1,
|
|
“Introduction”</a>.</p>
|
|
</div>
|
|
<div class="appendix">
|
|
<h2><a name="references" id="references"></a>A References</h2>
|
|
<div class="section">
|
|
<h3><a name="normative-references" id=
|
|
"normative-references"></a>A.1 Normative References</h3>
|
|
<div class="bibliolist">
|
|
<div class="bibliomixed" id="rfc2119">
|
|
<p>[<span class="abbrev">RFC 2119</span>] <a href=
|
|
"http://www.ietf.org/rfc/rfc2119.txt"><span class=
|
|
"citetitle"><cite>Key words for use in RFCs to Indicate Requirement
|
|
Levels</cite></span></a>. S. Bradner. Network Working Group, IETF,
|
|
Mar 1997.</p>
|
|
</div>
|
|
<div class="bibliomixed" id="xproc">
|
|
<p>[<span class="abbrev">XProc: An XML Pipeline Language</span>]
|
|
<a href="http://www.w3.org/TR/xproc/"><span class=
|
|
"citetitle"><cite>XML: An XML Pipeline Language</cite></span></a>.
|
|
Norman Walsh, Alex Milowski, and Henry S. Thompson, editors. W3C
|
|
Recommedation 11 May 2010.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="appendix">
|
|
<h2><a name="errors-list" id="errors-list"></a>B List of Error
|
|
Codes</h2>
|
|
<div class="section">
|
|
<h3><a name="app.step-errors" id=
|
|
"app.step-errors"></a>B.1 Step Errors</h3>
|
|
<p>The following <em class="glossterm">dynamic errors</em> are
|
|
explicitly called out in this note.</p>
|
|
<div id="step-error-summary">
|
|
<h5>Step Errors</h5>
|
|
<dl class="errs">
|
|
<dt><a name="err.C0026" id="err.C0026"></a><code class=
|
|
"errqname">err:XC0026</code></dt>
|
|
<dd>
|
|
<p>It is a dynamic error if any XPath expression makes reference to
|
|
the context node, size, or position when the context item is
|
|
undefined.</p>
|
|
<p>See: <a href="#err.inline.C0026">p:template</a></p>
|
|
</dd>
|
|
<dt><a name="err.C0067" id="err.C0067"></a><code class=
|
|
"errqname">err:XC0067</code></dt>
|
|
<dd>
|
|
<p>It is a dynamic error to encounter a single closing curly brace
|
|
“}” that is not immediately followed by another closing curly
|
|
brace.</p>
|
|
<p>See: <a href="#err.inline.C0067">p:template</a>, <a href=
|
|
"#err.inline.C0067.1">p:template</a>, <a href=
|
|
"#err.inline.C0067.2">p:template</a></p>
|
|
</dd>
|
|
<dt><a name="err.C0068" id="err.C0068"></a><code class=
|
|
"errqname">err:XC0068</code></dt>
|
|
<dd>
|
|
<p>It is a dynamic error if more than one document appears on the
|
|
source port.</p>
|
|
<p>See: <a href="#err.inline.C0068">p:template</a></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<p>Other errors may also arise, see [<a href="#xproc"><span class=
|
|
"abbrev">XProc: An XML Pipeline Language</span></a>] for a complete
|
|
discussion of error codes.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|