This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
position of arbitrary parent
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] position of arbitrary parent
- From: Laurence O Garfield <lgarfiel at students dot depaul dot edu>
- Date: Tue, 17 Jul 2001 12:55:02 -0500 (CDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
I'm back with another one...
I'm trying to parse through two input files, one is DocBook the other is
XHTML that serves as a template. The template file has alternate
namespace tags within it to trigger certain actions. However, I'm not
sure how to tell where in the DocBook source I am at a given point in the
template. For example, I have the template:
<xsl:template match="/">
<xsl:for-each select="chapter">
<xsl:apply-templates select="$chapterTemplate/html" />
</xsl:for-each>
</xsl:template>
That should call the template file for each <chapter> element in the book.
However, later on I need to intercept certain tags and replace them with
the chapter number. That is,
<xsl:template match="call:insert[@id='ChapTitle']">
<xsl:apply-templates select="$source/book/chapter/title"/>
</xsl:template>
Where <call:insert id="ChapTitle" /> is a placeholder in the template
file. How do I determine in the position() of the <chapter> from which it
is being called so that I can call back to it with the
<xsl:apply-templates /> tag?
Am I still technically within the same tree? If so, then I should be able
to use select="//chapter/title", shouldn't I? Although elsewhere in the
stylesheet I will need to reference the next and previous <chapter> tags
to the current one as well, which leaves me back with needing to know the
position() of the current <chapter> element.
--Larry Garfield
lgarfiel@students.depaul.edu
-- "If at first you don't succeed, skydiving isn't for you." :-)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list