General discussion

Locked

xsl:import

By mrost ·
I am developing an xsl sylesheet, and am having trouble getting the xsl:import tag to be functional. I understand that the import has a lower precendence that the original stylesheet but here's what I'm trying to do:

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--Author Mac Rost for TravelNow.com, copyright 2002, all rights reserved-->
<xsl:output method="html"/>
<xsl:import href="../xsl/error.xsl"/>
<xsl:template match="Exception">
<xsl:apply-templates/>
<xsl:apply-imports/>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<title>Hotel Availibility List Results</title>
</head>
<body bgcolor="#888888" text="red">
<xsl:for-each select="HotelAvailabilityListResults/Hotel">
<xsl:sort order="ascending" select="name" />
<table width="50%" bgcolor="#888888" text="black">
...
...
</xsl:for-each>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Any help would be appreciated!!
Mac

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

xsl:import

by Geert Pante In reply to xsl:import

Hi Mac,

I'm not sure what you want to do here. I assume that if there is an Exception tag in the source, you want to append the Exception using the error.xsl at the end of the (empty) list.

In that case, you should call an <xsl:apply-templates select="Exception"/> somewhere in the template that matches the root ("/").

In your error.xsl you should of course match "Exception".

I don't know why you want to override the "Exception" template in this stylesheet? Do you want to apply specific local templates before the one from error.xsl?

greetings, Geert.

Collapse -

xsl:import

by mrost In reply to xsl:import

Poster rated this answer

Collapse -

xsl:import

by Geert Pante In reply to xsl:import

Hi Mac,

I'm not sure what you want to do here. I assume that if there is an Exception tag in the source, you want to append the Exception using the error.xsl at the end of the (empty) list.

In that case, you should call an <xsl:apply-templates select="Exception"/> somewhere in the template that matches the root ("/").

In your error.xsl you should of course match "Exception".

I don't know why you want to override the "Exception" template in this stylesheet? Do you want to apply specific local templates before the one from error.xsl?

greetings, Geert.

Collapse -

xsl:import

by mrost In reply to xsl:import

Poster rated this answer

Collapse -

xsl:import

by mrost In reply to xsl:import

Thank you for your answer. I have worked around my problem with the ASP file that I am using for this.
Thanks!
Mac

Collapse -

xsl:import

by mrost In reply to xsl:import

This question was closed by the author

Back to Web Development Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums