Subject: Re: Transforming multiple XML files using multiple stylesheets
From: Gowri Ratakonda <gratakonda@xxxxxxxxx>
Date: Mon, 12 Jun 2006 09:51:08 -0700 (PDT)
|
Joe,
Thanks for responding.
The problem is that the <xsl:import> imports all the
contents from all the three XML files, but doesn't
apply any styles that I have in the function_table
stylesheet. When I look at the transformation in a
browser, the content of the source files is a long
line of text.
This is how I have imported the ft.xsl, function_table
stylesheet, in my main.xsl :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="US-ASCII" method="html"
media-type="text/html"/>
<xsl:import href="ft.xsl" />
<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="macro/macro_name" />
</title>
</head>
<body>
.
.
.
<!-- FT -->
<xsl:for-each select="/macro/ft">
<xsl:apply-templates
select="document@file)/function_table" />
</xsl:for-each>
<!-- Macro -->
<xsl:apply-templates select="macro/CV" />
.
.
.
</body>
</html>
</xsl:template>
-----------------------------------------------------
And this is how my ft.xsl looks:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="US-ASCII" method="html"
media-type="text/html" />
<xsl:template match="function_table">
<html>
<head>
<title>Function table </title>
</head>
<body>
<!-- Get mode number -->
<xsl:variable name="modes" select="count(//mode)" />
.
.
.
</xsl:template>
</xsl:stylesheet>
Thanks,
Gowri
--- Joe Fawcett <joefawcett@xxxxxxxxxxx> wrote:
> Gowri
>
> Sounds like you did the right thing.
> You need to turn the import into a full stylesheet
> though, with a root
> xsl:stylesheet element around <xsl:template
> match="function_table">.
> You could also try using xsl:include which acts more
> like a dynamic
> copy-and-paste.
>
> Show you file sif you still have problems.
>
> Joe
>
> ----- Original Message -----
> From: "Gowri Ratakonda" <gratakonda@xxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Friday, June 09, 2006 5:03 PM
> Subject: Transforming multiple XML files using
> multiple stylesheets
>
>
> >I have a master.xml file with three xml files
> included
> > like this:
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <macro>
> >
> > <! -- Include FT files -->
> >
> > <ft file="../fts/file_1.xml"/>
> > <ft file="../fts/file_2.xml"/>
> > <ft file="../fts/file_3.xml"/>
> >
> > .
> > .
> > .
> > </macro>
> >
> >
>
------------------------------------------------------
> >
> > In my master.xsl stylesheet, I do this to
> transform
> > the included XML files, which works perfectly
> fine:
> >
> > <xsl:for-each select="/macro/ft">
> > <xsl:apply-templates
> > select="document(@file)/function_table"/>
> > </xsl:for-each>
> >
> > <xsl:template match="function_table">
> > .
> > .
> > .
> > </xsl:template>
> >
>
----------------------------------------------------------------------
> >
> > Since I am planning on using the function_table
> > template for other transformations, I would like
> to
> > delete it from the master.xsl and put it in a
> separate
> > stylesheet,
> > and include the stylesheet in the master.xsl to
> > transform all the three XML files.
> > Could somebody point me to the right function to
> do
> > this because I couldn't make it work using
> > <xsl:import>.
> > Should I use <xsl:processing-instruction>? If yes,
> > what is the right syntax in XSLT1.0?
> >
> > Thanks,
> > Gowri
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|