Adding elements to merged XML document
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Mon Jun 05, 2017 7:30 pm
Adding elements to merged XML document
I am new to XML/XSL and have a question regarding adding elements to merged XML files. I have managed to merge 400+ XML files, but cannot figure out how to batch add an element to each. I hope this makes sense. I am working with the MODS schema and need to add the <mods:note type="ownership"> element to each record.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Adding elements to merged XML document
Hi,
How did you merge the 400 XML files, did you use an XSL stylesheet or a plain text merge and some manual fixing?
If you use a copy stylesheet, you should be able to create an xsl:template for the parent element in which you want to add that new element.
e.g.
Regards,
Adrian
How did you merge the 400 XML files, did you use an XSL stylesheet or a plain text merge and some manual fixing?
If you use a copy stylesheet, you should be able to create an xsl:template for the parent element in which you want to add that new element.
e.g.
Code: Select all
<!-- Match document -->
<xsl:template match="/">
<xsl:apply-templates mode="copy" select="."/>
</xsl:template>
<!-- Deep copy template -->
<xsl:template match="*|text()|@*" mode="copy">
<xsl:copy>
<xsl:apply-templates mode="copy" select="@*"/>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*:myparent" mode="copy">
<xsl:copy>
<xsl:apply-templates mode="copy" select="@*"/>
<mods:note type="ownership"/>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
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