Note that there are some explanatory texts on larger screens.

plurals
  1. PORename XML elements using XSLT
    primarykey
    data
    text
    <p>I need to change some of the element names in the original XML. I am trying to do this with XSLT, but can't get it to work. </p> <p>Here is a sample of XML:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?xml-stylesheet href="test.xsl" type="text/xsl"?&gt; &lt;html&gt; &lt;body&gt; &lt;section&gt;Jabber&lt;/section&gt; &lt;itemtitle&gt;JabberJabber&lt;/itemtitle&gt; &lt;p&gt;Always Jabber Jabber Jabber&lt;/p&gt; &lt;h3&gt;Emboldened Requests &lt;/h3&gt; &lt;p&gt;Somemore Jabber Here&lt;/p&gt; &lt;img scr="bigpicture.jpg"&gt;&lt;/img&gt; &lt;poll&gt;&lt;p&gt;Which statement best characterizes you?&lt;/p&gt;&lt;/poll&gt; &lt;pcredit&gt;Left: Jumpin Jasper/Jumpy Images&lt;/pcredit&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I need to change it to:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?xml-stylesheet href="test.xsl" type="text/xsl"?&gt; &lt;html&gt; &lt;body&gt; &lt;div class="issuehead"&gt;Jabber&lt;/div&gt; &lt;div class="issuetitle"&gt;JabberJabber&lt;/div&gt; &lt;p&gt;Always Jabber Jabber Jabber&lt;/p&gt; &lt;h3&gt;Emboldened Requests &lt;/h3&gt; &lt;p&gt;Somemore Jabber Here&lt;/p&gt; &lt;img scr="bigpicture.jpg"&gt;&lt;/img&gt; &lt;div class="poll"&gt;&lt;p&gt;Which statement best characterizes you?&lt;/p&gt;&lt;/div&gt; &lt;div class="pcredit"&gt;Left: Jumpin Jasper/Jumpy Images&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here is the XSLT I did, but I can't get it to work:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="html" /&gt; &lt;xsl:template match="/"&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;xsl:apply-templates/&gt; &lt;/body&gt; &lt;/html&gt; &lt;xsl:template match="section"&gt; &lt;div class="issuehead"&gt;&lt;xsl:value-of select="."/&gt;&lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="itemtitle"&gt; &lt;div class="issuetitle"&gt; &lt;xsl:value-of select="."/&gt;&lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="img"&gt;&lt;/xsl:template&gt; &lt;xsl:template match="poll"&gt; &lt;div class="poll"&gt;&lt;xsl:value-of select="."/&gt;&lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="pcredit"&gt; &lt;div class="pcredit"&gt;&lt;xsl:value-of select="."/&gt;&lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="p"&gt;&lt;/xsl:template&gt; &lt;xsl:template match="h3"&gt;&lt;/xsl:template&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Thanks for the help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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