[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: seamless processing of multiple XML fragments
What a sweet little problem - it really shows off how well the features of XSLT work together. Here's what you can do - wrote a transform (below) with just two templates. Make one of them a pure pass-through template for everything else, and the other a template for include elements. Them make the include template pass through the contents of the referenced file. Results below - HTH Francis. C:\xml>type t.xslt t.xml t2.xml t3.xml t.xslt <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="include"> <xsl:apply-templates select="document(@file)" /> </xsl:template> </xsl:stylesheet> t.xml <root> <a> <b>B</b> <include file="t2.xml"/> </a> <g> <h>H</h> <i>I</i> </g> </root> t2.xml <c> <d>D</d> <e>E</e> <include file="t3.xml"/> </c> t3.xml <f>F</f> C:\xml> C:\xml>saxon t.xml t.xslt <?xml version="1.0" encoding="utf-8"?><root> <a> <b>B</b> <c> <d>D</d> <e>E</e> <f>F</f> </c> </a> <g> <h>H</h> <i>I</i> </g> </root> C:\xml> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|