Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6123379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:00:35+00:00 2026-05-23T16:00:35+00:00

I have an assignment on converting the input xml using xslt. My input xml

  • 0

I have an assignment on converting the input xml using xslt.

My input xml file,

<?xml version="1.0" encoding="UTF-8"?>
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data>
    <z:row ID="1" CK="B0011" Description="VSC" DTC="B0000" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP"/>
    <z:row ID="2" CK="B0012" Description="VSC_1" DTC="B0011" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP"/>   
    <z:row ID="3" CK="B0013" Description="VSC_2" DTC="B0012" Variant="" AN="Y" Notes="" GCategory="M54" System="VOS" Ownership="EEP"/>  
    <z:row ID="4" CK="B0014" Description="VSC_3" DTC="B0013" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP"/>   
    <z:row ID="5" CK="B0015" Description="VSC_4" DTC="B0014" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP"/>   
</rs:data>
</xml>

Excepted XML Output:

<DF>
<Cage Revision="" RevisionDate="" CPType="Authored" Ext_Identifier="">
    <Entities>
        <StdDTCs>
            <StdDTC Action="Insert" CK="B0011" Description  ="VSC" DTC="B0000" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP"/>
            <StdDTC Action="Insert" CK="B0012" Description  ="VSC_1" DTC="B0011" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP"/>
            <StdDTC Action="Insert" CK="B0013" Description  ="VSC_2" DTC="B0012" Variant="" AN="Y" Notes="" GCategory="M54" System="VOS" Ownership="EEP"/>
            <StdDTC Action="Insert" CK="B0014" Description  ="VSC_3" DTC="B0013" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP"/>
            <StdDTC Action="Insert" CK="B0015" Description  ="VSC_4" DTC="B0014" Variant="" AN="Y" Notes="  " GCategory="M3" System="VOS" Ownership="EEP"/>
        </StdDTCs>
        <ABCDs>
        <ABCD/>
        ...............
        ...............
        ...............
        <ABCD/>
        </ABCDs>
    </Entities>
</Cage>
</DF>

I tried a bit on the xslt.

<?xml version="1.0" encoding="UTF-8"?>

<xsl:key name="UID" match="z:row/@ID" use="."/>
<xsl:template match="/">
    <DF>
        <Cage>
            <xsl:attribute name="Revision"><xsl:value-of select="''"/></xsl:attribute>
            <xsl:attribute name="RevisionDate"><xsl:value-of select="''"/></xsl:attribute>
            <xsl:attribute name="ChangePackageType"><xsl:value-of select="'Authored'"/></xsl:attribute>
            <xsl:attribute name="Ext_Identifier"><xsl:value-of select="''"/></xsl:attribute>
            <xsl:apply-templates select="@*|node()"/>
        </Cage>
    </DF>
</xsl:template>

<!--    <xsl:template match="rs:data">
    <Entities>
        <StandardDTCs>
            <xsl:apply-templates select="StandardDTC"/>
        </StandardDTCs>
        </Entities>
</xsl:template> -->
<xsl:template match="rs:data">
<StdDTCs>
    <StdDTC>
        <xsl:attribute name="Action"><xsl:value-of select="'Insert'"/></xsl:attribute>
        <xsl:attribute name="CK"><xsl:value-of select="z:row/@CK"/></xsl:attribute>
        <xsl:attribute name="Description"><xsl:value-of select="z:row/@Description"/></xsl:attribute>
        <xsl:attribute name="DTC"><xsl:value-of select="z:row/@DTC"/></xsl:attribute>
        <xsl:attribute name="Variant"><xsl:value-of select="z:row/@DTC"/></xsl:attribute>
        <xsl:attribute name="AN"><xsl:value-of select=""/></xsl:attribute>
        <xsl:attribute name="Notes"><xsl:value-of select=""/></xsl:attribute>
        <xsl:attribute name="GCategory"><xsl:value-of select=""/></xsl:attribute>
        <xsl:attribute name="System"><xsl:value-of select=""/></xsl:attribute>
        <xsl:attribute name="Ownership"><xsl:value-of select=""/></xsl:attribute>
    </StdDTC>
</StdDTCs>
</xsl:template>
</xsl:stylesheet>

Help me in framing this xslt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:00:36+00:00Added an answer on May 23, 2026 at 4:00 pm

    Use this (your solution slightly modified):

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset"
    >
        <xsl:output method="xml" indent="yes"/>
    
        <xsl:template match="/">
            <DF>
                <Cage>
                    <xsl:attribute name="Revision">
                        <xsl:value-of select="''"/>
                    </xsl:attribute>
                    <xsl:attribute name="RevisionDate">
                        <xsl:value-of select="''"/>
                    </xsl:attribute>
                    <xsl:attribute name="ChangePackageType">
                        <xsl:value-of select="'Authored'"/>
                    </xsl:attribute>
                    <xsl:attribute name="Ext_Identifier">
                        <xsl:value-of select="''"/>
                    </xsl:attribute>
                    <StdDTCs>
                        <xsl:apply-templates select="@*|node()"/>
                    </StdDTCs>
                </Cage>
            </DF>
        </xsl:template>
    
        <xsl:template match="rs:data/z:row">
            <StdDTC Action="Insert">
                <xsl:for-each select="@*">
                    <xsl:attribute name="{name()}">
                        <xsl:value-of select="."/>
                    </xsl:attribute>
                </xsl:for-each>
            </StdDTC>
        </xsl:template>
    </xsl:stylesheet>
    

    Output:

    <?xml version="1.0" encoding="utf-8"?>
    <DF xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset">
        <Cage Revision="" RevisionDate="" ChangePackageType="Authored" Ext_Identifier="">
            <StdDTCs>
    
                <StdDTC Action="Insert" ID="1" CK="B0011" Description="VSC" DTC="B0000" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP" />
                <StdDTC Action="Insert" ID="2" CK="B0012" Description="VSC_1" DTC="B0011" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP" />
                <StdDTC Action="Insert" ID="3" CK="B0013" Description="VSC_2" DTC="B0012" Variant="" AN="Y" Notes="" GCategory="M54" System="VOS" Ownership="EEP" />
                <StdDTC Action="Insert" ID="4" CK="B0014" Description="VSC_3" DTC="B0013" Variant="" AN="Y" Notes="" GCategory="M1" System="VOS" Ownership="EEP" />
                <StdDTC Action="Insert" ID="5" CK="B0015" Description="VSC_4" DTC="B0014" Variant="" AN="Y" Notes="" GCategory="M3" System="VOS" Ownership="EEP" />
    
            </StdDTCs>
        </Cage>
    </DF>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an assignment in a language-independent class, and part of it is using
For my university assignment I have to make a networkable version of pacman. I
I have an assignment where I need to implement church numerals in SML using
I have to read data from a file for an assignment unfortunately instead of
So I am being taught assembly and we have an assignment which is to
For my assignment I have been assigned the task of creating a DTD for
I currently have a school assignment that involves both PHP and asp.net. Now the
For a school assignment I have to write x86 assembly code, except I can't
For my university assignment I have to design some basic managment system for sicknesses
For a database assignment I have to model a system for a school. Part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.