This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

xsl:include problem


G'Day All,

Could someone clarify this for me please?
xsl:include is the equivalent Apache's Server Side Includes:
Using xsl:include a section of text is inserted into the document *before*
the templates are applied.

I've been trying to chop my library.xsl doc into includes that can be
included as needed across multiple xsl stylesheets.
The element templates that are between "image_link" & "date" I want to place
into an include file:
"elements.xsl".

Every time that I've tried it both with the msxml3 parser & AxKit on Apache
I get an "Unspecified error".

library.xsl
---------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp       "&#160;"   > ] >

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns="http://www.w3.org/1999/xhtml"; version="1.0">

<xsl:output method="xml" media-type="text/html" omit-xml-declaration="yes"
indent="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" encoding="UTF-8" />

<xsl:template match="/">
<html>
<head>
 <title>My Library 20-07-2001</title>
 <link rel="stylesheet" href="library.css" type="text/css" />
</head>
<body>
<div>

 <xsl:for-each select="/library">
  <xsl:apply-templates select="book[@variant = 'Book' and @style =
'Fiction']" />
  <xsl:apply-templates select="book[@variant = 'Book' and @style =
'Non-Fiction']" />
  <xsl:apply-templates select="book[@variant = 'Graphic_Novel' and @style =
'Fiction']" />
  <xsl:apply-templates select="book[@variant = 'Magazine' and @style =
'Non-Fiction']" />
 </xsl:for-each>

</div>
</body>
</html>
</xsl:template>


<!-- TEMPLATE (BOOK + FICTION) -->
<xsl:template match="book[@variant = 'Book' and @style = 'Fiction']">
 <table class="xShellTable" cellspacing="0" cellpadding="4" width="516px"
height="1px">
  <tr>
   <td valign="top" class="xShellTableImage" width="120px">
    <xsl:apply-templates select="image_link" />
   </td>
   <td valign="top" class="xShellTableText" width="380px">
    <table class="xTextTable" cellpadding="2" width="380px" height="158px"
cellspacing="0">
     <xsl:apply-templates select="title" />
     <xsl:apply-templates select="sub-title" />
     <xsl:apply-templates select="author" />
     <xsl:apply-templates select="illustrator" />
     <xsl:apply-templates select="description" />
     <xsl:apply-templates select="isbn" />
     <xsl:apply-templates select="genre" />
     <xsl:apply-templates select="publisher" />
    </table>
   </td>
  </tr>
 </table>
<p><br /></p>
</xsl:template>
<!-- END TEMPLATE (BOOK + FICTION) -->


<!-- TEMPLATE (BOOK + NON-FICTION) -->
<xsl:template match="book[@variant = 'Book' and @style = 'Non-Fiction']">
 <table class="xShellTable" cellspacing="0" cellpadding="4" width="516px"
height="1px">
  <tr>
   <td valign="top" class="xShellTableImage" width="120px">
    <xsl:apply-templates select="image_link" />
   </td>
   <td valign="top" class="xShellTableText" width="380px">
    <table class="xTextTable" cellpadding="2" width="380px" height="158px"
cellspacing="0">
     <xsl:apply-templates select="title" />
     <xsl:apply-templates select="sub-title" />
     <xsl:apply-templates select="author" />
     <xsl:apply-templates select="illustrator" />
     <xsl:apply-templates select="description" />
     <xsl:apply-templates select="isbn" />
     <xsl:apply-templates select="subject" />
    </table>
   </td>
  </tr>
 </table>
<p><br /></p>
</xsl:template>
<!-- END TEMPLATE (BOOK + NON-FICTION) -->


<!-- TEMPLATE (GRAPHIC_NOVEL + FICTION) -->
<xsl:template match="book[@variant = 'Graphic_Novel' and @style =
'Fiction']">
 <table class="xShellTable" cellspacing="0" cellpadding="4" width="516px"
height="1px">
  <tr>
   <td valign="top" class="xShellTableImage" width="120px">
    <xsl:apply-templates select="image_link" />
   </td>
   <td valign="top" class="xShellTableText" width="380px">
    <table class="xTextTable" cellpadding="2" width="380px" height="158px"
cellspacing="0">
     <xsl:apply-templates select="title" />
     <xsl:apply-templates select="sub-title" />
     <xsl:apply-templates select="author" />
     <xsl:apply-templates select="illustrator" />
     <xsl:apply-templates select="description" />
     <xsl:apply-templates select="isbn" />
     <xsl:apply-templates select="genre" />
    </table>
   </td>
  </tr>
 </table>
<p><br /></p>
</xsl:template>
<!-- END TEMPLATE (GRAPHIC_NOVEL + FICTION) -->


<!-- TEMPLATE (MAGAZINE + NON-FICTION) -->
<xsl:template match="book[@variant = 'Magazine' and @style =
'Non-Fiction']">
 <table class="xShellTable" cellspacing="0" cellpadding="4" width="516px"
height="1px">
  <tr>
   <td valign="top" class="xShellTableImage" width="120px">
    <xsl:apply-templates select="image_link" />
   </td>
   <td valign="top" class="xShellTableText" width="380px">
    <table class="xTextTable" cellpadding="2" width="380px" height="158px"
cellspacing="0">
     <xsl:apply-templates select="title" />
     <xsl:apply-templates select="sub-title" />
     <xsl:apply-templates select="author" />
     <xsl:apply-templates select="illustrator" />
     <xsl:apply-templates select="description" />
     <xsl:apply-templates select="isbn" />
     <xsl:apply-templates select="subject" />
     <xsl:apply-templates select="issue" />
     <xsl:apply-templates select="date" />
    </table>
   </td>
  </tr>
 </table>
<p><br /></p>
</xsl:template>
<!-- END TEMPLATE (MAGAZINE + NON-FICTION) -->


<!-- TEMPLATE ERROR TRAP -->
<xsl:template match="book" priority="-1"><table border="1"
cellspacing="4"><tr><td>ERROR</td></tr></table></xsl:template>
<!-- END TEMPLATE TITLE -->

<!-- ******* INCLUDE STARTS HERE ******* -->

<!-- TEMPLATE IMAGE_LINK -->
<xsl:template match="image_link">
 <table class="xImageTable" cellspacing="0" cellpadding="0" width="120px">
  <tr>
   <td class="xImageTableTd" bgcolor="#cccc99" width="120px">
    <img border="2px" width="120px" height="151px" alt=""
onClick="javascript:alert('NOT FINISHED');">
     <xsl:attribute name="src">
      <xsl:value-of select="." />
      <xsl:if test="not(string())">null.gif</xsl:if>
     </xsl:attribute>
    </img >
   </td>
  </tr>
 </table>
</xsl:template>
<!-- END TEMPLATE IMAGE_LINK -->


<!-- TEMPLATE TITLE -->
<xsl:template match="title">
 <xsl:if test="string()"><tr><td><b>Title: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE TITLE -->


<!-- TEMPLATE SUB-TITLE -->
<xsl:template match="sub_title">
 <xsl:if test="string()"><tr><td><b>Sub-Title: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE SUB-TITLE -->


<!-- TEMPLATE DESCRIPTION -->
<xsl:template match="description">
 <xsl:if test="string()"><tr><td><b>Description: </b> <xsl:value-of
select="." /></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE DESCRIPTION -->


<!-- TEMPLATE ISBN -->
<xsl:template match="isbn">
 <xsl:if test="string()"><tr><td><b>ISBN: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE ISBN -->


<!-- TEMPLATE GENRE -->
<xsl:template match="genre">
 <xsl:if test="string()"><tr><td><b>Genre: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE GENRE -->


<!-- TEMPLATE PUBLISHER -->
<xsl:template match="publisher">
 <xsl:if test="string()"><tr><td><b>Publisher: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE PUBLISHER -->


<!--TEMPLATE SUBJECT -->
<xsl:template match="subject">
 <xsl:if test="string()"><tr><td><b>Subject: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE SUBJECT -->


<!-- TEMPLATE ISSUE -->
<xsl:template match="issue">
 <xsl:if test="string()"><tr><td><b>Issue: </b> <xsl:value-of select="."
/></td></tr></xsl:if>
</xsl:template>
<!-- END TEMPLATE ISSUE -->


<!-- TEMPLATE AUTHOR -->
<xsl:template match="author">
 <xsl:if test="string()">
  <tr><td><b>Author <xsl:value-of select="." />: </b>
   <xsl:if test="@first_name != ''"><xsl:value-of select="@first_name"
/>&nbsp;</xsl:if>
   <xsl:if test="@middle_name != ''"><xsl:value-of select="@middle_name"
/>&nbsp;</xsl:if>
   <xsl:if test="@last_name != ''"><xsl:value-of select="@last_name"
/></xsl:if>
  </td></tr>
 </xsl:if>
</xsl:template>
<!-- END TEMPLATE AUTHOR -->


<!-- TEMPLATE ILLUSTRATOR -->
<xsl:template match="illustrator">
 <xsl:if test="string()">
  <tr><td><b>Illustrator <xsl:value-of select="." />: </b>
   <xsl:if test="@first_name != ''"><xsl:value-of select="@first_name"
/>&nbsp;</xsl:if>
   <xsl:if test="@middle_name != ''"><xsl:value-of select="@middle_name"
/>&nbsp;</xsl:if>
   <xsl:if test="@last_name != ''"><xsl:value-of select="@last_name"
/></xsl:if>
  </td></tr>
 </xsl:if>
</xsl:template>
<!-- END TEMPLATE ILLUSTRATOR -->


<!-- TEMPLATE DATE -->
<xsl:template match="date">
   <tr><td><b>Date: </b>
     <xsl:if test="@day != ''"><xsl:value-of select="@day" />-</xsl:if>
     <xsl:if test="@month != ''"><xsl:value-of select="@month"
/>&nbsp;</xsl:if>
     <xsl:if test="@year != ''"><xsl:value-of select="@year" /></xsl:if>
   </td></tr>
</xsl:template>
<!-- END TEMPLATE DATE -->

<!-- ******* INCLUDE ENDS HERE ******* -->

</xsl:stylesheet>
---------------------------------------------------------


Thanks,
            Oliver Reid
            Perth, Western Australia
            dante@vianet.net.au
            www.vianet.net.au/~dante




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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]