Solved

XSLT doubt

Posted on 2013-06-27
3
362 Views
Last Modified: 2013-06-28
Hi All,

I have to build XML from another XML file using XSLT 2.0.

I try to build wherever <include seriesId=""> element called, i should build XML based on seriesId.

I have attached here my input xml and expect output, please help to build xml.
input.xml
output.xml
0
Comment
Question by:xedge88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 39283645
Try this

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">
    
    <xsl:key name="fragment" match="fragment" use="series"/>
    
    <xsl:template match="root">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="Code"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="node()">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="include | DMS-Include">
        <xsl:apply-templates select="key('fragment', @seriesId)/content/node()"/>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

0
 

Author Comment

by:xedge88
ID: 39283667
Hi Gertone,

Thanks for quick and correct reply!

Thanks and regards,
Saran
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39283722
welcome
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Date on a table 16 36
How to insert clean border ? 6 35
CSS for Popup in ASP.NET 4 19
Where are custom labels in Word 2016 stored? 2 17
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question