Merge XML FILE
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 147
- Joined: Sat Oct 19, 2013 8:21 am
Merge XML FILE
Hi,
I have 2 xml file
File 1:
File 2:
I want :
I do not know how this merge in XSLT
Thank you
I have 2 xml file
File 1:
Code: Select all
<a>
<b>xxxxxx</b>
<c>yyyyyyy</c>
<d>
<table/>
</d>
</a>
Code: Select all
<table>
<row><col>ssssss</col><col>rrrrrrr</col></row>
</table>
Code: Select all
<a>
<b>xxxxxx</b>
<c>yyyyyyy</c>
<d>
<table>
<row><col>ssssss</col><col>rrrrrrr</col></row>
</table>
</d>
</a>
Thank you
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Merge XML FILE
Hi,
You can use a copy stylesheet (e.g. Oxygen/samples/xhtml/copy.xsl) with a small modification that treats the table element individually.
e.g. The stylesheet is applied on the first XML and it's expected that the second XML is named s2.xml.
Regards,
Adrian
You can use a copy stylesheet (e.g. Oxygen/samples/xhtml/copy.xsl) with a small modification that treats the table element individually.
e.g. The stylesheet is applied on the first XML and it's expected that the second XML is named s2.xml.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<!-- Match document -->
<xsl:template match="/">
<xsl:apply-templates mode="copy" select="."/>
</xsl:template>
<!-- Deep copy template -->
<xsl:template match="*|text()|@*" mode="copy">
<xsl:message><xsl:value-of select="."/></xsl:message>
<xsl:copy>
<xsl:apply-templates mode="copy" select="@*"/>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
<xsl:template match="table" mode="copy">
<xsl:copy>
<xsl:apply-templates select="document('s2.xml')/table/*" mode="copy"/>
</xsl:copy>
</xsl:template>
<!-- Handle default matching -->
<xsl:template match="*"/>
</xsl:stylesheet>
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service