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]

Re: Selecting a descendant child at arbitrary depth


Hi Peter,

> Now, I have invented a tag called <docBody> which surrounds the
> XHTML that I am actually interested in. What I want to do is copy
> the contents of the <docBody> to the output, but ignore anything
> else that surrounds it:

It should work if you just have:

  <xsl:template match="mainDisplay">
    <xsl:copy-of select=".//docBody/*" />
  </xsl:template>

If that doesn't work, then I'd suspect a namespace issue (i.e. the
docBody in the source XML is actually in a default namespace but
you're trying to find one in the null namespace).  Either that or the
docBody doesn't have any element content - you might try:

  <xsl:template match="mainDisplay">
    <xsl:copy-of select=".//docBody/node()" />
  </xsl:template>

instead.

Or, possibly, you have some other template around that's matching the
docBody with greater priority.  If you use the above you'll get round
that - as long as the mainDisplay template matches then the copy
should be made.

I hope that helps,

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]