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: template question: copy-of and non-continuous children and grandchildren


Hi Mike,

> I have a question about how I can call a template for children and
> grandchildren in as <xsl:copy-of select="node()"/>.
>
> I have been processing all C1007 nodes with a template. But these
> C1007 nodes occur at different levels of the C1009 node sometimes as
> great great grand children but all C1007 are within ITEM node.
>
> What do you think would be the best way to do this?

If you only want to apply templates to the C1007 elements, you can
step down to them with:

  <xsl:apply-templates select="ITEM/descendant::C1007" />

or, if you prefer:

  <xsl:apply-templates select="ITEM//C1007" />

So your template for the C1009 element would be:

<xsl:template match="C1009">
  <NOTE ENCODINGANALOG="{@LINK}">
    <LIST>
      <xsl:apply-templates select="ITEM//C1007" />
    </LIST>
  </NOTE>
</xsl:template>

This would give you a NOTE element, with a LIST element inside it, and
within that the NOTE and P elements generated by the template for the
C1007 element, one for each of the C1007 elements in the source
document, no matter what level they were at within the C1009 element.

Is that what you were after?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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]