xsl-list
[Top] [All Lists]

Re: [xsl] Problem with xslfo

2006-10-11 07:41:57
On Wednesday 11 October 2006 15:27, meenakshi n wrote:
Hi all:

I have  problem, I will try to explain as much as
possible here.

I have an XML like this:

<root>
<level1>
  <note>Some note</note>
<text>Some text here</text
</level1>
<level1>
   <text><para>some text</para></text>
</level1>
</root>

Now, level1 has been formatted to put numbers 1,2 ...
When I run the XSLFO, this is what I desire to see:

NOTE: Some note
1.Some text here
2.Some text

So even though note is a child of level1, I want it to
appear above level1. Instead, here is what I get

1.Note:Somenote
 Some text here
2.Some text

In fact, the number 1 and Note overlap.

I tried to check under the template for note if the
parent is level1. But I realised Icannot do that
becaouse there can be any number of level1s in the XML
document. I am only concerned about the first one.

Can anyone please suggest a way of solving this?
Thank you in advance.

If you can change your XML it may be easier. Because then you could do 
something like this:

<root>
 <level n="1">
   <note>Some note</note>
 <text>Some text here</text
 </level>
 <level n="1">
    <text><para>some text</para></text>
 </level>
</root>

and go:

<xsl:template match="level">
  <xsl:apply-templates select="note" />
  <xsl:value-of select="position()" /> <!-- or however you're doing 
numbers -->
  <xsl:apply-templates select="text" />
</xsl:template>

And you would still be able to distinguish between levels where you needed to:

<xsl:template match="level[(_at_)n=1]">
or
<xsl:template match="level[(_at_)n>=4 and @n>10]">

Cheers,
Richard
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
Sonic Arts Research Archive
http://www.sara.uea.ac.uk/
JID: ironchicken(_at_)jabber(_dot_)earth(_dot_)li
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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