[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: following-sibling is not working

Subject: RE: following-sibling is not working
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Oct 2006 11:41:27 -0400
RE:  following-sibling is not working
At 2006-10-18 10:34 -0500, rfd ewrew wrote:
Thank you Michael. I think the problem is a
little more complicated to me and I will try to explain it.

The XML looks like this:

<ele1>
<step1><table></table></step1>
<graphic>URL for graphic</graphic>
<table>This is actually the CALS table model </table>
</ele1>

Now, I wanted to template match all elements
except graphic and so under ele1 i said
<xsl:apply-templates select=*(not[self::graphic])/> which worked just fine.

The next thing I wanted to do was to check if
the following sibling of graphic was table, and
if it was table, I wanted to display the table
just below the graphic. The "table" element can
appear anywhere in the XML, but only if it
appears after <graphic> I want it to display below graphic.

This will test the immediately following element is a table:


test="following-sibling::*[1][self::table}"

This <table> element follows the CALS table model.

So under <graphic> template I said
<xsl:if
test="following-sibling::table"><xsl:apply-templates
select="table" mode="test"/></xsl:if>

Your if is testing all following siblings named "table" and your apply is acting on *children* elements named "table".

But since the CALS table has other elements like
tgroup, row, entry which have all templates,
when I say <xsl:template match "table"
mode="test"> this does not force <table> below <graphic>.

That isn't a match problem ... once you "gain control" of a table you can do with it what you want.

How do I match <table> element which is in CALS
format? I even tried adding mode to all other elements under <table> like
this:

<xsl:template match="tgroup" mode="test">

That would only work if you used the mode during the apply


Can anyone help me out here?

Perhaps you'll get what you want when you fix the fact you were looking for children named table instead of the immediately following sibling named table.

I hope this helps.

. . . . . . . . . . . . Ken

--
UBL/XSLT/XSL-FO training: Allerxd/Verx Denmark 2006-11-13,17,20/24
UBL International 2006  2006-11-13/17 http://www.ublconference.com
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.