[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:import or xsl:include or another alternative?

Subject: RE: xsl:import or xsl:include or another alternative?
From: "jim" <xsl@xxxxxxxxxxxxxxxxx>
Date: Tue, 1 Jul 2003 07:51:03 -0700
javascript include import
thanks brian,

> Put the template into a separate stylesheet (say, product.xslt), then use
> xsl:import or xsl:include in your other stylesheets to make it available:
>
> <xsl:import href="product.xslt"/>
> <!-- or whatever the proper path is; this can be relative to the importing
> stylesheet -->

So is this a "clean" way of doing the above or is there a more convenient
logic to easily change the layout but also only show 1 product's details per
page?

<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:import href="product.xslt" />
  <xsl:output method="html" />
  <xsl:param name="category_id" select="'1.01'" />
  <xsl:template match="/">
    <xsl:apply-templates
select="catalogue/product[category_id=$category_id]" />
  </xsl:template>
</xsl:stylesheet>


<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="product">
    <p class="heading"><xsl:value-of select="item_name"/> [<xsl:value-of
select="category_id"/>]</p>
    <p class="description"><xsl:value-of select="description"/></p>
	<p class="details">Colours: <xsl:value-of select="colours"/><br />
    Fabric: <xsl:value-of select="fabric"/><br />
    Sizes: <xsl:value-of select="sizes"/><br />
    Retail Price: CDN <xsl:value-of select="price_cdn"/> | USD <xsl:value-of
select="price_usd"/><br />
    Shipping: <xsl:value-of select="shipping"/></p>
    <p class="verysmall">More Views: <a
href="javascript:swapProdImg(0);">front</a> | <a
href="javascript:swapProdImg(1);">side</a> | <a
href="javascript:swapProdImg(2);">back</a> | <a
href="javascript:swapProdImg(3);">detail</a><br />
    Matching Items: <a><xsl:attribute
name="href">/retail/group/<xsl:value-of select="group_number"
/>/index.html</xsl:attribute><xsl:value-of select="merch_group" /></a><br />
    Browse By Category: <a><xsl:attribute
name="href">/retail/category/<xsl:value-of select="category_number"
/>/index.html</xsl:attribute><xsl:value-of select="category" /></a></p>
  </xsl:template>
</xsl:stylesheet>




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.