Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this:</p> <pre><code> &lt;?xml version="1.0" encoding="iso-8859-1"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:variable name="webpage" select="document('webpage.xml')/webpage"/&gt; &lt;!-- No input document - so we set the initial template to start when we call the transform --&gt; &lt;xsl:template name="start"&gt; &lt;xsl:apply-templates select="$webpage/@*|$webpage/node()"/&gt; &lt;/xsl:template&gt; &lt;!-- This template is the identity transform and will copy everything from the input to the output unless there a template that is a better match --&gt; &lt;xsl:template match="@*|node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;!-- This template overrides the identity transform and changes the heading to an h3 --&gt; &lt;xsl:template match="/webpage/heading"&gt; &lt;h3&gt;&lt;xsl:value-of select="."/&gt;&lt;/h3&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>when applied to the supplied input xml produces:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;webpage&gt; &lt;h3&gt;Header&lt;/h3&gt; &lt;p&gt; paragraph &lt;a href="http://www.google.com"&gt;google&lt;/a&gt; more paragraph&lt;/p&gt; &lt;ul&gt; &lt;li&gt;item1&lt;/li&gt; &lt;li&gt;item2&lt;/li&gt; &lt;li&gt;item3&lt;/li&gt; &lt;li&gt;item4&lt;/li&gt; &lt;li&gt;item5&lt;/li&gt; &lt;li&gt;item6&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;more paragraph&lt;a href="http://www.potato.com"&gt;potato.com&lt;/a&gt;&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;h3&gt;heading&lt;/h3&gt; &lt;p&gt; here comes a list:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;item1&lt;/li&gt; &lt;li&gt;item2&lt;/li&gt; &lt;li&gt;item3&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;p&gt;more paragraph&lt;/p&gt; &lt;/webpage&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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