Note that there are some explanatory texts on larger screens.

plurals
  1. POxml xslt help - transform is not rendering correctly
    primarykey
    data
    text
    <p>i have an xml file like for binding:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;MyCustomer&gt; &lt;Customers&gt; &lt;CutomerCode&gt;C001&lt;/CutomerCode&gt; &lt;CustomerName&gt;Shahbaz&lt;/CustomerName&gt; &lt;City&gt;Karachi&lt;/City&gt; &lt;Country&gt;Pakistan&lt;/Country&gt; &lt;/Customers&gt; &lt;Customers&gt; &lt;CutomerCode&gt;C002&lt;/CutomerCode&gt; &lt;CustomerName&gt;Imran&lt;/CustomerName&gt; &lt;City&gt;Lahore&lt;/City&gt; &lt;Country&gt;Pakistan&lt;/Country&gt; &lt;/Customers&gt; &lt;/MyCustomer&gt; </code></pre> <p>I am Applying the XSLT:</p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;xsl:output indent="yes"/&gt; &lt;xsl:template match="MyCustomer"&gt; &lt;xsl:copy&gt; &lt;Customers&gt; &lt;xsl:apply-templates select="Customers/*"/&gt; &lt;/Customers&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="Customers/*"&gt; &lt;xsl:copy&gt; &lt;xsl:value-of select="."/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="Customers/City"&gt; &lt;xsl:element name="Address"&gt; &lt;xsl:element name="City"&gt; &lt;xsl:value-of select="." /&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template match="Customers/Country"&gt; &lt;xsl:element name="Address"&gt; &lt;xsl:element name="Country"&gt; &lt;xsl:value-of select="." /&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>and this XSLT is giving me the result : </p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;MyCustomer&gt; &lt;Customers&gt; &lt;CutomerCode&gt;C001&lt;/CutomerCode&gt; &lt;CustomerName&gt;Shahbaz&lt;/CustomerName&gt; &lt;Address&gt; &lt;City&gt;Karachi&lt;/City&gt; &lt;/Address&gt; &lt;Address&gt; &lt;Couontry&gt;Pakistan&lt;/Couontry&gt; &lt;/Address&gt; &lt;CutomerCode&gt;C002&lt;/CutomerCode&gt; &lt;CustomerName&gt;Imran&lt;/CustomerName&gt; &lt;Address&gt; &lt;City&gt;Lahore&lt;/City&gt; &lt;/Address&gt; &lt;Address&gt; &lt;Country&gt;Pakistan&lt;/Country&gt; &lt;/Address&gt; &lt;/Customers&gt; &lt;/MyCustomer&gt; </code></pre> <p>while i required the transform like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;MyCustomer&gt; &lt;Customers&gt; &lt;CutomerCode&gt;C001&lt;/CutomerCode&gt; &lt;CustomerName&gt;Shahbaz&lt;/CustomerName&gt; &lt;Address&gt; &lt;City&gt;Karachi&lt;/City&gt; &lt;Country&gt;Pakistan&lt;/Country&gt; &lt;/Address&gt; &lt;CutomerCode&gt;C002&lt;/CutomerCode&gt; &lt;CustomerName&gt;Imran&lt;/CustomerName&gt; &lt;Address&gt; &lt;City&gt;Lahore&lt;/City&gt; &lt;Couontry&gt;Pakistan&lt;/Couontry&gt; &lt;/Address&gt; &lt;/Customers&gt; &lt;/MyCustomer&gt; </code></pre> <p>Please Help I want the transformation correctly.please help i want the correct xslt method please help</p>
    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.
 

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