OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: DOCBOOK-APPS: XSLT question - referencing one node and the one after it

I am writing up an XSLT stylesheet to convert a document from 
another XML format (custom DTD) to DocBook XML. I've run into a
stumbling block... all my XSLT books are at home... and I want
to demo this stylesheet this afternoon... so I thought I would 
just bounce the question out here in case anyone here might have
the quick answer...  (if you do, MANY thanks!)

In the other XML format, a table is defined roughly by:


All of the tables in the source documents are two columns, so setting
up a DocBook <tgroup cols="2"> is easy.  The challenge I am having
is to iterate through the <item> elements and convert each block of
two <item> elements to something like:


So far, what I have is this... in the XSLT template for <items>, I
have the following snippet:

  <xsl:for-each select="item">
      <xsl:when test="(position() mod 2)=1">
	<xsl:apply-templates select="."/>
XXX	<xsl:apply-templates select="node()[position()+1]"/>

The "XXX" marks my problem line.  It doesn't work.  What I am trying to
do is to apply templates to the current <item> node (the first line)
and the next <item> node (the XXX line).  It *does* work for the first
line, but not for the second.

And yes, the loop can be simplified to simply an <xsl:if> in place of the
<xsl:choose> (since <xsl:otherwise> does nothing)... it is <xsl:choose>
because that was how I started trying this out.

There is separately a template for "<item>" that handles processing of
the stuff inside of the <item> element.

Any help anyone can offer will be most appreciated.


Dan York, Director of Training        dyork@e-smith.com
Ph: +1-613-751-4401 Cell: +1-613-263-4312 Fax: +1-613-564-7739 
Mitel Network Corporation Network Server Solutions Group 
150 Metcalfe St., Suite 1500, Ottawa,ON K2P 1P1 Canada
http://www.e-smith.com/            http://www.mitel.com/           

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC