RE: [xsl] following-sibling is not working

Subject: RE: [xsl] following-sibling is not working
From: "rfd ewrew" <xmlquestions101@xxxxxxxxxxx>
Date: Wed, 18 Oct 2006 10:34:50 -0500
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:

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

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 <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>

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>.

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"> Can anyone help me out here?

Thank you.

From: "Michael Kay" <mike@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] following-sibling is not working
Date: Tue, 17 Oct 2006 22:20:19 +0100

Can't see anything wrong with it.

Are you sure that the match="graphic" template is being fired? - there's
nothing in it that would leave any evidence one way or the other.

Michael Kay

> -----Original Message-----
> From: rfd ewrew [mailto:xmlquestions101@xxxxxxxxxxx]
> Sent: 17 October 2006 21:41
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] following-sibling is not working
> Hi:
> My XML looks like this:
> <ele1>
> <graphic>URL for graphic</graphic>
> <table>The complete table </table>
> </ele1>
> In XSLT, to check if the next sibling is a table , under
> template match for graphic I used this code;
> <xsl:template match="graphic">
> <xsl:if test="following-sibling::table"> <xsl:call-template
> name="test"/> </xsl:if> </xsl:template>
> <xsl:template name="test">
> <fo:block>Test</fo:block>
> </xsl:template>
> But somehow, it is notcoming to the template test at all. Is
> there anything wrong with this code?
> _________________________________________________________________
> Get today's hot entertainment gossip

Get FREE company branded e-mail accounts and business Web site from Microsoft Office Live

Current Thread