?
Solved

XSLT doubt

Posted on 2013-06-27
3
Medium Priority
?
364 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 2000 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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Suggested Courses

770 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