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

RE: Newbie: template matching and multiple document ou

Subject: RE: Newbie: template matching and multiple document output
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 29 Jan 2002 17:48:27 -0000
michael perriman
> Dear List,
>
> This is my second attempt to post this problem. I have read
> all recent posts
> on template matching but can't get the answer.
>
> The aim is to convert the xml file below into: 1) an index
> page in html,
> with links to all sub-files - this uses template "id" and
> works fine, 2) one
> html page for each "part", with the file name MSC01.html,
> MSC02.html, etc,
> containing just the text from that part. The best I can get
> is one html
> page, named MSC01.html, which contains the text from all the "parts".
>
You are calling this code

   <xsl:template name="document" match="//@id">
   <xsl:for-each select = "part">
     <xsl:document href = "{//@id}.html" method = "html">

Once for each document you want to generate. But because you use "//@id" to
form the filename, each document has the same name.

You should use @id, since the context node at the time you call the template
is a <part> element with an @id attribute. And get rid of the match
attribute, since you are calling the template by name, not using
apply-templates.

Actually, you would be better off restructuring this so you do use
apply-templates rather than call-template, but that's irrelevant to the
problem.

You're going to have to correct a few other errors, most of your patterns
and path expressions, e.g.

   <xsl:template name="kind" match="/@kind">
      <xsl:for-each select="/*[@kind != '']">

suggest that you haven't really grasped the difference between absolute and
relative paths.

Mike Kay




 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.