Re: [xsl] Using one nodeset to dictate the format of data from another nodeset

Subject: Re: [xsl] Using one nodeset to dictate the format of data from another nodeset
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 7 Jun 2007 00:57:49 +0100
your posted input isn't well formed, but fixing that I think you just
want something like the code below

A note on terminology though

> I have two nodesets in a single XML document.

you're using xslt2 so it doesn't have a node set type, having been
replaced by sequence.

In a given document (in Xpath 1) there are always 2 to the n  node sets,
where n is the number of nodes, so always at least 4, (as there are
always at least 2 nodes in a well formed document) In XPath2 of course
there are infinitely many possible node sequences. You meant (I assume
from the example) there were two parts of the document of interest, or
perhaps you meant there were two input documents, I assumed the former
and added a container element <x> to your posted input.

> I would also like to be able to set the header levels within my
> content based on the depth of the content element. Is it possible to
> "feed" a template data from the template that called it?

Yes, template parameters do exactly that, but perhaps you just want
, I'm not sure.


    <content id="id1">content-1</content>
  <content id="id2">content-2</content>

  <topic-ref idref="id1" >
     <topic-ref idref="id2" />

<xsl:stylesheet version="2.0" xmlns:xsl="";>
<xsl:strip-space elements="*"/>

  <xsl:template match="/">
	<xsl:apply-templates select="x/structure-data"/>

  <xsl:template match="topic-ref">
      <xsl:value-of select="key('c',@idref)"/>

  <xsl:key name="c" match="content" use="@id"/>

$ saxon8 j.xml j.xsl
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread