xsl-list
[Top] [All Lists]

RE: Can one stylesheet handle two different xml files with different nodes?

2004-01-15 14:08:50
I've been looking at the namespace-alias element, but I am still
confused how this helps me transform two different xml files using one
Stylesheet.  The only thing that I have been able to do is convert one
Stylesheet to another.  I could do this using the replace feature in my
IDE in a timelier manner.  

I'm probably just pretty confused on this.  Maybe someone can shed some
more light on this?

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Michael Kay
Sent: Thursday, January 15, 2004 5:43 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Can one stylesheet handle two different xml files
with different nodes?

Sorry, I'm not aware of any more detailed worked examples. I've come
across projects making very elaborate use of meta-stylesheets, but I
can't point you to any resources. But stylesheets are just XML
documents, so you should be able to work it out for yourself.

Michael Kay

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
kakridge(_at_)bellsouth(_dot_)net
Sent: 14 January 2004 19:56
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Can one stylesheet handle two different 
xml files with different nodes?


Michael, I see a trivial example in your book(p. 255, 2ed) 
using the namespace-alias tag.  I assume this is the 
procedure that I need to follow.  Is there a more in depth 
detail or a resource on the web that explains this in depth?

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Michael Kay
Sent: Wednesday, January 14, 2004 2:33 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Can one stylesheet handle two different 
xml files with different nodes?

This might be a case for using a "meta-stylesheet", i.e. a 
stylesheet that transforms the stylesheet.

Michael Kay

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf 
Of 
kakridge(_at_)bellsouth(_dot_)net
Sent: 14 January 2004 17:17
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Can one stylesheet handle two different xml 
files with different nodes?


If I have two xml files with identical structure, but with
different node names, I know I can write one Stylesheet to 
handle both files. However, is there a more efficient way 
then the following?  This seems pretty simple, but what if 
the file is 3 or 4 megabytes?

For instance:

<ArrayOfBooks>
    <Book>
            <Title>FOO</Title>
    </Book>
</ArrayOfBooks>

and

<ArrayOfMagazines>
    <Magazine>
            <Title>FOOTOO</Title>
    </Magazine>
</ArrayOfMagazines>

With this Stylesheet:

<xsl:template match="/">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="ArrayOfBooks | ArrayOfMagazines">
    <table>
            <xsl:apply-templates/>
    </table>
</xsl:template>

<xsl:template match="Book | Magazine">
    <tr>
            <td>
                    <xsl:value-of select="Title"/>
            </td>
    </tr>
</xsl:template>


 XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info 
and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list