Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>XSL is a scripting language for XML, <strong><em>written as XML</em></strong>. Because it is XML, all instructions are XML tags, and likewise all opening XML tags need closing XML tags.</p> <p>For XSL, this snippet is actually very concise.</p> <p>Your summation of what the code does is correct. XSL is pretty easy to learn, but I'll clarify a few tags for you</p> <pre><code>&lt;xsl:template name="break-tag"&gt; ... &lt;/xsl:template&gt; </code></pre> <p>An xsl:template is roughly equivalent to a function</p> <pre><code>&lt;xsl:param name="string" select="string(.)"/&gt; </code></pre> <p>This is an input parameter to the template/function. String(.) is the text that is currently in scope when this template is called</p> <pre><code>&lt;xsl:analyze-string select="$string" regex="&amp;lt;br&amp;gt;" flags="i"&gt; &lt;xsl:matching-substring&gt; &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;\n&amp;gt;&lt;/xsl:text&gt; &lt;/xsl:matching-substring&gt; &lt;xsl:non-matching-substring&gt; &lt;xsl:call-template name="open-list-tag"/&gt; &lt;/xsl:non-matching-substring&gt; &lt;/xsl:analyze-string&gt; </code></pre> <p>This compares the string against a regular expression. If there is a match, then "&lt;\n&gt;" is written to the output. If there isn't a match, then another template (open-list-tag) is called.</p> <hr> <p>Edit - On duplication</p> <p>XSL has a switch/case instruction as well as expanded regex functionality. You might be able to modify this to do what you need:</p> <pre><code>&lt;xsl:choose&gt; &lt;xsl:when test="matches(string(.),'&amp;lt;br&amp;gt;')"&gt; &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;\n&amp;gt;&lt;/xsl:text&gt; &lt;/xsl:when&gt; &lt;xsl:when test="matches(string(.),'&amp;lt;li&amp;gt;')"&gt; &lt;xsl:text disable-output-escaping="yes"&gt;@F07/2 Bullet Points:&lt;/xsl:text&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:text&gt;Unkown Tag: &lt;xsl:value-of select="string(.)"/&gt;&lt;/xsl:text&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&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