[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] Can one stylesheet handle two different xml files with different nodes?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 14 Jan 2004 19:33:21 -0000

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@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> kakridge@xxxxxxxxxxxxx
> Sent: 14 January 2004 17:17
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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



Current Thread
Keywords
xml