Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>Is there a way to generate the special tags &lt;?php ?&gt; or &lt;%= %&gt; directly during the XSL transform? </code></pre> <p><code>&lt;?php ?&gt;</code> is not a "special tag" -- this is of a standard node type in the XPath data model -- a <strong><a href="http://www.w3.org/TR/1999/REC-xpath-19991116/#section-Processing-Instruction-Nodes" rel="nofollow">processing instruction</a></strong>.</p> <p>there is also an XSLT instruction to create a PI:</p> <p><strong><a href="http://www.w3.org/TR/1999/REC-xslt-19991116#section-Creating-Processing-Instructions" rel="nofollow"><code>&lt;xsl:processing-instruction&gt;</code></a></strong></p> <p>Finally, you can create text like "&lt;%= %>" if you use the <strong>text</strong> <em>output</em> method:</p> <pre><code>&lt;xsl:output method="text"/&gt; </code></pre> <p>but in the <em>text</em> output method you loseany node -- you should enter every output character as text.</p> <p>So, it is a little-bit more convenient to use the default <em>xml</em> output method and the (non-mandatory!) attribute <code>disable-output-escaping="yes"</code> if this is supported by your XSLT processor.</p> <p><strong>Here is an example</strong>:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output omit-xml-declaration="yes"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:processing-instruction name="php"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt; &amp;lt;% Hello World! %&gt; &lt;/xsl:text&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p><strong>applying this transformation to any XML document (not used) produces</strong>:</p> <pre><code>&lt;?php?&gt; &lt;% Hello World! %&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload