[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: seamless processing of multiple XML fragments
You can just add a template to your stylesheet that processes your include elements. Here, for example, is a stylesheet that does an identity transform with any depth of includes in your sample files. Replace the identity transform with your own templates and you need not be concerned about the include elements. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" /> <xsl:strip-space elements="*"/> <xsl:template match="include"> <xsl:apply-templates select="document(@file)/*"/> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Dan -----Original Message----- From: Dan Diebolt [mailto:dandiebolt@xxxxxxxxx] Sent: Monday, September 03, 2001 2:28 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: seamless processing of multiple XML fragments I have some xml that looks like this conceptually: <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> However, the XML is actually stored in two files: File1.xml: <root> <a> <b>B</b> <include file="File2.xml"/> </a> <g> <h>H</h> <i>I</i> </g> </root> File2.xml: <c> <d>D</d> <e>E</e> <f>F</f> </c> The tag <include file="File2.xml"/> conceptually shows where the xml fragment in the second file should be inserted into xml fragment in the first file. I could accept any mechanism that allows this type of insertion. Here is my questions to the list: Is there a way to implement this so that the XSLT processing is seamless? I don;t want to concern myself with tracing nested includes in writing the XSLT. Your help is appreciated. Regards, Dan __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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
|