xsl-list
[Top] [All Lists]

RE: [xsl] following-sibling is not working

2006-10-18 08:42:01
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: Allerød/Vårø 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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--