Subject: Re: Accessing 2 xml files in xsl From: "Steve Muench" <smuench@xxxxxxxxxxxxx> Date: Wed, 19 Apr 2000 09:21:43 -0700 |
These are the first ideas that came to mind. Consider XML files a.xml, b.xml, and c.xml below <!-- a.xml --> <row> <ename>Steve</ename> </row> <!-- b.xml --> <row> <ename>Francis</ename> </row> <?xml version="1.0"?> <!-- c.xml --> <!DOCTYPE rowset [ <!ENTITY a SYSTEM "a.xml"> <!ENTITY b SYSTEM "b.xml"> ]> <rowset> &a; &b; </rowset> Then the stylesheet below illustrates two ways to "process both a.xml and b.xml files" the first way uses "c.xml" that includes a.xml and b.xml as external entities to "glue" them together. The second uses the XPath | operator to "or" the "a.xml" and "b.xml" docs together. The result of doing: $ oraxsl anything.xml stylesheetbelow.xsl is: Steve Francis Steve Francis Hope this gives some ideas... <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:apply-templates select="document('c.xml')//rowset"/> <xsl:apply-templates select=" document('a.xml')//row | document('b.xml')//row"/> </xsl:template> <xsl:template match="rowset"> <xsl:apply-templates select="row"/> </xsl:template> <xsl:template match="row"> <xsl:value-of select="ename"/> <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet> _________________________________________________________ Steve Muench, Consulting Product Manager & XML Evangelist Business Components for Java Development Team ----- Original Message ----- From: "Selva, Francis" <Francis.Selva@xxxxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxx> Sent: Wednesday, April 19, 2000 8:45 AM Subject: RE: Accessing 2 xml files in xsl | This is what I have.But how can it access from 2 different xml files?.Should | I have to define all the different template matches then?.Is there a way I | can just define one template like "/" and get all those values from both xml | files? | | Francis | | | | | | | > | > here was the example David gave. | > ============================================ | > xsl:import is for importing stylesheets, ie for structuring your | > stylesheet out of smaller modules. So is no use at all for | > what you want | > to do. | > | > if your countries are in countries.xml then just go | > | > <xsl:apply-templates select="document('countries.xml')"/> | > | > and write some templates to transform your file | > into the list on your html. | > | > David | > ============================================ | > | > I hope this will partially redeem me :) | > also the "Index by Date" link on the xsl-list site is bad | > http://www.mulberrytech.com/xsl/xsl-list/archive/maillist.html | > "Index by Thread" works though. | > | > Noah | | > | | | 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: Accessing 2 xml files in xsl, David Carlisle | Thread | RE: Accessing 2 xml files in xsl, Charlie Cox |
RE: parameter setting, Selva, Francis | Date | 2 xml inside 1 xsl, Selva, Francis |
Month |