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]
Other format: [Raw text]

RE: Newbie: template matching and multiple document output


> 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


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