|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Merging xml files
Using Instant Saxon 6.5.3 I have seen previous posts but a bit comfounded at getting it to work for me... want to merge identical xml files using xslt the following is what I have so far...any help on what my stylesheet should be would be gratefully received, thaks. ctt.xml <?xml version="1.0" encoding="ISO-8859-1"?> <ctt> <doc filename="test1.xml"/> <doc filename="test2.xml"/> <doc filename="test3.xml"/> </ctt> test1.xml - all xml files have the same format <?xml version="1.0" encoding="ISO-8859-1"?> <ctt> <ctt_doc ctt_doc_ref="1"> <parent_doc_ref>testthis</parent_doc_ref> </ctt_doc> </ctt> bad xslt stylesheet...(i.e. not working) <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="ctt"> <ctt> <xsl:variable name="docs" select="document(ctt/doc/@filename)"/> <xsl:for-each select="$docs"> <xsl:copy-of select="./ctt_doc"/> <xsl:copy-of select="ctt/ctt_doc/parent_doc_ref"/> </xsl:for-each> </ctt> </xsl:template> </xsl:stylesheet> current output upon: saxon -o newtest.xml ctt.xml merge.xsl <?xml version="1.0" encoding="utf-8"?> <ctt/> would like... <?xml version="1.0" encoding="ISO-8859-1"?> <ctt> <ctt_doc ctt_doc_ref="1"> <parent_doc_ref>testthis</parent_doc_ref> </ctt_doc> <ctt_doc ctt_doc_ref="2"> <parent_doc_ref>testthis</parent_doc_ref> </ctt_doc> <ctt_doc ctt_doc_ref="3"> <parent_doc_ref>testthis</parent_doc_ref> </ctt_doc> </ctt>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








