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

[xsl] linking to and displaying xsl templates


Subject: [xsl] linking to and displaying xsl templates
From: "Jesse Wiles" <jwiles@xxxxxxxxxxxx>
Date: Thu, 14 Nov 2002 09:17:16 -0600

Hi.
I have an xml document for which I would like to create a TOC entirely
through an XSL stylesheet.  The idea is to create html hyperlinks which
point to <xsl:template> elements in the .xsl document.  So:

<?xml version="1.0"?>
 <xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

 <xsl:template match="/">
  <a href="some_way_to_link_to.xml#template_Apples">Apples</a>
  <a href="some_way_to_link_to.xml#template_Oranges">Oranges</a>
  <a href="some_way_to_link_to.xml#template_Pears">Pears</a>
  <a href="some_way_to_link_to.xml#template_Grapes">Grapes</a>
 </xsl:template> 

 <xsl:template match="Apples">
  ...formatting...
 </xsl:template>

 <xsl:template match="Oranges">
  ...formatting...
 </xsl:template>

 <xsl:template match="Pears">
  ...formatting...
 </xsl:template>

 <xsl:template match="Grapes">
  ...formatting...
 </xsl:template>

</xsl:stylesheet>

with xml source that looks like:

<?xml version='1.0' encoding='UTF-8'?>
 <?xml-stylesheet href="wwh.xsl" type="text/xsl"?>

 <Source>

  <Apples>
    children and descendents
  </Apples>

  <Oranges>
    children and descendent
  </Oranges>

  <Pears>
    children and descendents
  </Pears>

  <Grapes>
    children and descendents
  </Grapes>

 </Source>

 

The idea is to create several HTML output pages from the single xml
source doc.  It seems like it should be pretty straightforward, but I've
been having a tough time sorting it out.  Please advise.

Thanks.

Jesse Wiles

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



Current Thread
Keywords