Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use this (your solution slightly modified):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset" &gt; &lt;xsl:output method="xml" indent="yes"/&gt; &lt;xsl:template match="/"&gt; &lt;DF&gt; &lt;Cage&gt; &lt;xsl:attribute name="Revision"&gt; &lt;xsl:value-of select="''"/&gt; &lt;/xsl:attribute&gt; &lt;xsl:attribute name="RevisionDate"&gt; &lt;xsl:value-of select="''"/&gt; &lt;/xsl:attribute&gt; &lt;xsl:attribute name="ChangePackageType"&gt; &lt;xsl:value-of select="'Authored'"/&gt; &lt;/xsl:attribute&gt; &lt;xsl:attribute name="Ext_Identifier"&gt; &lt;xsl:value-of select="''"/&gt; &lt;/xsl:attribute&gt; &lt;StdDTCs&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/StdDTCs&gt; &lt;/Cage&gt; &lt;/DF&gt; &lt;/xsl:template&gt; &lt;xsl:template match="rs:data/z:row"&gt; &lt;StdDTC Action="Insert"&gt; &lt;xsl:for-each select="@*"&gt; &lt;xsl:attribute name="{name()}"&gt; &lt;xsl:value-of select="."/&gt; &lt;/xsl:attribute&gt; &lt;/xsl:for-each&gt; &lt;/StdDTC&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <hr> <p>Output:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;DF xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset"&gt; &lt;Cage Revision="" RevisionDate="" ChangePackageType="Authored" Ext_Identifier=""&gt; &lt;StdDTCs&gt; &lt;StdDTC Action="Insert" ID="1" CK="B0011" Description="VSC" DTC="B0000" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP" /&gt; &lt;StdDTC Action="Insert" ID="2" CK="B0012" Description="VSC_1" DTC="B0011" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP" /&gt; &lt;StdDTC Action="Insert" ID="3" CK="B0013" Description="VSC_2" DTC="B0012" Variant="" AN="Y" Notes="" GCategory="M54" System="VOS" Ownership="EEP" /&gt; &lt;StdDTC Action="Insert" ID="4" CK="B0014" Description="VSC_3" DTC="B0013" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP" /&gt; &lt;StdDTC Action="Insert" ID="5" CK="B0015" Description="VSC_4" DTC="B0014" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP" /&gt; &lt;/StdDTCs&gt; &lt;/Cage&gt; &lt;/DF&gt; </code></pre>
    singulars
    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.
    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.
    3. 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