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

Subject: [xsl] Using one nodeset to dictate the format of data from another nodeset
From: "Rebecca O'Connell" <rebecca321@xxxxxxxxx>
Date: Wed, 6 Jun 2007 19:40:26 -0400
I have two nodesets in a single XML document. I am trying to output
the data from the first nodeset in a format derived from the contents
of the second nodeset. The problem is that the second nodeset is
nested elements with the same name. This means I need a recursive
template call to make the output nest properly. This results in extra
calls to the template. I know what's wrong with my current approach,
but I can't figure out how to fix it. Does anyone know how to solve
this problems?

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?

I am using XSL 2.0, Saxon 8B, XML 1.0

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

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



XSL: <xsl:key name="id" match="concept" use="@id" /> <xsl:key name="idref" match="*" use="@idref" />

 <xsl:template match="topic-ref">

<xsl:when test="boolean(./*)">

       <div class="TOPIC-REF">
<!-- Select the source node which corresponds to the idref in the
structure node -->
         <xsl:apply-templates select="key('id', ./@idref)"/>
         <xsl:for-each select="./topic-ref">
           <xsl:apply-templates select="topic-ref"/>
         <xsl:apply-templates  select="topic-ref"/>
     <xsl:when test="not(./*) and name(../.)='content'">
       <xsl:apply-templates select="key('id', ./@idref)"/>

I have been banging my head against the wall all day and I am hoping
there is an elegant way to do this that I just didn't manage to figure

Thank you,

Current Thread