Subject: RE: [xsl] Including multiple XML documents with associated stylesheets From: cknell@xxxxxxxxxx Date: Wed, 19 Nov 2003 10:00:09 -0500 |
It sounds like you are trying to pass a slew of XML documents to a browser and have the browser sort out which stylesheet to apply to which document. If this is correct, you are asking too much of the browser. Do a server-side transformation and send the result to the browser. If this is not correct, please ignore this message. -- Charles Knell cknell@xxxxxxxxxx - email -----Original Message----- From: Alex Hildyard <alexhildyard@xxxxxxxxxxx> Sent: Wed, 19 Nov 2003 13:55:22 -0000 To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx> Subject: [xsl] Including multiple XML documents with associated stylesheets Hi, I've looked through the FAQ but haven't found a solution to this problem: I'm trying to include multiple XML documents, and each sub-document has its own stylesheet. What I find is that I can load each sub-document in isolation and its associated stylesheet is applied without problems (test-file.xml), but the stylesheet is blatantly ignored when I try to load it as part of a collection of documents (files-list.xml). My understanding is that the individual stylesheets' markup isn't being applied because I've never explicitly requested it to be applied, but I'm not quite sure exactly what "apply-templates" argument I would want in this case? I'm enclosing the files below, to make things a bit clearer: Many thanks, Alex [files-list.xml] <?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="iterate-files.xslt" ?> <!-- This top-level document holds references to the set of external files that should be marked up on this page. It can also hold any scripts that should be globally accessible --> <html> <head /> <body> <files> <file src="test-file.xml"></file> <file src="test-file2.xml"></file> </files> </body> </html> [iterate-files.xslt] <?xml version="1.0" encoding="UTF-8" ?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <!-- This template iterates through the file list defined within a <files> element and processes the set of external XML files contained within it --> <xsl:template match="files"> <xsl:for-each select="file"> <xsl:for-each select="document(@src)"> <xsl:copy-of select="test" /> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:transform> [test-file.xml] <?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="test-file.xslt" ?> <test> <div> This tag shouldn't appear </div> </test> [test-file.xslt] <?xml version="1.0" encoding="UTF-8" ?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <!-- All the directives in this file seem toget ignored --> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <!-- Template to prove directives in this file are processed: replace the contents of the <div> with a new string --> <xsl:template match="div"> This text should appear </xsl:template> </xsl:transform> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Including multiple XML do, Wendell Piez | Thread | RE: [xsl] XSL Tool, Andrew Welch |
RE: [xsl] Filtering using list of p, cknell | Date | RE: [xsl] XSL Tool, Andrew Welch |
Month |