Subject: Re: [xsl] Problem with xslfo From: Richard Lewis <richardlewis@xxxxxxxxxxxxxx> Date: Wed, 11 Oct 2006 15:41:33 +0100 |
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[@n=1]"> or <xsl:template match="level[@n>=4 and @n>10]"> Cheers, Richard -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard Lewis Sonic Arts Research Archive http://www.sara.uea.ac.uk/ JID: ironchicken@xxxxxxxxxxxxxxx -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Problem with xslfo, meenakshi n | Thread | Re: [xsl] Problem with xslfo, David Carlisle |
[xsl] Problem with xslfo, meenakshi n | Date | Re: [xsl] Problem with xslfo, David Carlisle |
Month |