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 8184089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:22:53+00:00 2026-06-07T01:22:53+00:00

I have following XML: <?xml version=1.0 encoding=utf-8?> <Rowsets> <Rowset> <Columns> <Column Description=DrilldownDepth MaxRange=1 MinRange=0

  • 0

I have following XML:

<?xml version="1.0" encoding="utf-8"?>
<Rowsets>
    <Rowset>
        <Columns>
            <Column Description="DrilldownDepth" MaxRange="1" MinRange="0" Name="DrilldownDepth" SQLDataType="4" SourceColumn="DrilldownDepth"/>
            <Column Description="ABC" MaxRange="1" MinRange="0" Name="ABC" SQLDataType="4" SourceColumn="ABC"/>
            <Column Description="DEF" MaxRange="1" MinRange="0" Name="DEF" SQLDataType="-1" SourceColumn="DEF"/>
            <Column Description="PQR" MaxRange="1" MinRange="0" Name="PQR" SQLDataType="-1" SourceColumn="PQR"/>
        </Columns>
        <Row>
            <DrilldownDepth>1</DrilldownDepth>
            <ABC>25</ABC>
            <DEF>DDD</DEF>
            <PQR>PPP</PQR>
        </Row>
        <Row>
            <DrilldownDepth>1</DrilldownDepth>
            <ABC>16</ABC>
            <DEF>AAA</DEF>
            <PQR>BBB</PQR>
        </Row>
        <Row>
            <DrilldownDepth>1</DrilldownDepth>
            <ABC>19</ABC>
            <DEF>SEE</DEF>
            <PQR>HELP</PQR>
        </Row>
    </Rowset>
</Rowsets>

Now I need to add in every Row. hence my XML will look like following:

<?xml version="1.0" encoding="utf-8"?>
<Rowsets>
    <Rowset>
        <Columns>
            <Column Description="DrilldownDepth" MaxRange="1" MinRange="0" Name="DrilldownDepth" SQLDataType="4" SourceColumn="DrilldownDepth"/>
            <Column Description="ABC" MaxRange="1" MinRange="0" Name="ABC" SQLDataType="4" SourceColumn="ABC"/>
            <Column Description="DEF" MaxRange="1" MinRange="0" Name="DEF" SQLDataType="-1" SourceColumn="DEF"/>
            <Column Description="PQR" MaxRange="1" MinRange="0" Name="PQR" SQLDataType="-1" SourceColumn="PQR"/>
        </Columns>
        <Row>
            <DrilldownDepth>1</DrilldownDepth>
            <ABC>25</ABC>
            <DEF>DDD</DEF>
            <PQR>PPP</PQR>
            <XYZ></XYZ>
        </Row>
        <Row>
            <DrilldownDepth>1</DrilldownDepth>
            <ABC>16</ABC>
            <DEF>AAA</DEF>
            <PQR>BBB</PQR>
            <XYZ></XYZ>
        </Row>
        <Row>
            <DrilldownDepth>1</DrilldownDepth>
            <ABC>19</ABC>
            <DEF>SEE</DEF>
            <PQR>HELP</PQR>
            <XYZ></XYZ>
        </Row>
    </Rowset>
</Rowsets>

How can I achive this using transform / XSLT?

I tried various XSLT but somehow I am not able to achieve it.

Soham

  • 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-06-07T01:22:56+00:00Added an answer on June 7, 2026 at 1:22 am

    This simple XSLT:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output omit-xml-declaration="no" indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <!-- Template #1 -->
      <xsl:template match="node()|@*">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
      </xsl:template>
    
      <!-- Template #2 -->
      <xsl:template match="Row">
        <xsl:copy>
          <xsl:apply-templates />
          <XYZ></XYZ>
        </xsl:copy>
      </xsl:template>
    
    </xsl:stylesheet>
    

    …when applied to the original XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <Rowsets>
      <Rowset>
        <Columns>
          <Column Description="DrilldownDepth" MaxRange="1" MinRange="0" Name="DrilldownDepth" SQLDataType="4" SourceColumn="DrilldownDepth"/>
          <Column Description="ABC" MaxRange="1" MinRange="0" Name="ABC" SQLDataType="4" SourceColumn="ABC"/>
          <Column Description="DEF" MaxRange="1" MinRange="0" Name="DEF" SQLDataType="-1" SourceColumn="DEF"/>
          <Column Description="PQR" MaxRange="1" MinRange="0" Name="PQR" SQLDataType="-1" SourceColumn="PQR"/>
        </Columns>
        <Row>
          <DrilldownDepth>1</DrilldownDepth>
          <ABC>25</ABC>
          <DEF>DDD</DEF>
          <PQR>PPP</PQR>
        </Row>
        <Row>
          <DrilldownDepth>1</DrilldownDepth>
          <ABC>16</ABC>
          <DEF>AAA</DEF>
          <PQR>BBB</PQR>
        </Row>
        <Row>
          <DrilldownDepth>1</DrilldownDepth>
          <ABC>19</ABC>
          <DEF>SEE</DEF>
          <PQR>HELP</PQR>
        </Row>
      </Rowset>
    </Rowsets>
    

    …produces the desired result:

    <?xml version="1.0" encoding="UTF-8"?><Rowsets>
      <Rowset>
        <Columns>
          <Column Description="DrilldownDepth" MaxRange="1" MinRange="0" Name="DrilldownDepth" SQLDataType="4" SourceColumn="DrilldownDepth"/>
          <Column Description="ABC" MaxRange="1" MinRange="0" Name="ABC" SQLDataType="4" SourceColumn="ABC"/>
          <Column Description="DEF" MaxRange="1" MinRange="0" Name="DEF" SQLDataType="-1" SourceColumn="DEF"/>
          <Column Description="PQR" MaxRange="1" MinRange="0" Name="PQR" SQLDataType="-1" SourceColumn="PQR"/>
        </Columns>
        <Row>
          <DrilldownDepth>1</DrilldownDepth>
          <ABC>25</ABC>
          <DEF>DDD</DEF>
          <PQR>PPP</PQR>
          <XYZ/>
        </Row>
        <Row>
          <DrilldownDepth>1</DrilldownDepth>
          <ABC>16</ABC>
          <DEF>AAA</DEF>
          <PQR>BBB</PQR>
          <XYZ/>
        </Row>
        <Row>
          <DrilldownDepth>1</DrilldownDepth>
          <ABC>19</ABC>
          <DEF>SEE</DEF>
          <PQR>HELP</PQR>
          <XYZ/>
        </Row>
      </Rowset>
    </Rowsets>
    

    Explanation:

    • Template #1 is the Identity Template; it copies all nodes/attributes as-is (unless it gets overridden by subsequent templates).
    • Template #2 copies every <row> element, processes its children (via the Identity Template), and adds the desired <XYZ> node.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML: <?xml version=1.0 encoding=UTF-8?> <game> <name>Space Blaster</name> <description></description> <version>1</version> <fullscreen>false</fullscreen>
I have a following wsdl from a WCF service. <?xml version=1.0 encoding=utf-8?> <wsdl:definitions name=Service
I have the following XML Document: <?xml version=\1.0\ encoding=\UTF-8\?> <atom:entry xmlns:atom=\http://www.w3.org/2005/Atom\ xmlns:apps=\http://schemas.google.com/apps/2006\ xmlns:gd=\http://schemas.google.com/g/2005\> <apps:property
I have the following simplified XML: <?xml version="1.0" encoding="UTF-8" ?> <MATMAS05> <IDOC BEGIN="1"> <E1MARAM
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8" ?> <INVOIC02> <IDOC BEGIN="1">
Currently I have following XML: <Rowsets> <Rowset> <Row> <DrilldownDepth>0</DrilldownDepth> <ScheduleWeek>---</ScheduleWeek> <ABC>---</ABC> <PQR>1500</PQR> <XYZ>15000</XYZ> <Quant>285</Quant>
For example, say I have the following xml in a string: <?xml version=1.0 encoding=UTF-8?>
I have the following XML document <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' xmlns:issues='http://schemas.google.com/projecthosting/issues/2009' gd:etag='W/DEAERH47eCl7ImA9WhZTFEQ.'><id>http://code.google.com/feeds/issues/p/chromium/issues/full/921</id><published>2008-09-03T22:51:22.000Z</published><updated>2011-03-19T01:05:05.000Z</updated><title>Incorrect rendering</title><content
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8"?> <ExportData> <TransportHeader> <Timestamp>2011-01-16 06:00:33</Timestamp>
I have following XML schema: <?xml version=1.0 encoding=UTF-8 standalone=no?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=content type=contentType/>

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.