Subject: RE: [xsl] XSLT 1.0: Grouping Adjacent Elements in Embedded Lists From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 08 Nov 2004 12:52:39 -0500 |
Cheers, Wendell
Hi Wendell,
When I do this:
> <xsl:if test="not(preceding-sibling::OL_LI)"> > <p> > <ol> > <xsl:apply-templates select="." mode="li"/> > </ol> > </p> > </xsl:if>
Then, my <OL_LI> items aren't processed at all in the embedded list. Though I have an <OL_LI> list without embedded items that shows up fine.
And when I do this:
> <xsl:if test="not(preceding-sibling::*[1][self::OL_LI|self::EM_OL_LI])"> > <p> > <ol> > <xsl:apply-templates select="." mode="li"/> > </ol> > </p> > </xsl:if>
<p> <ol> <li>Top: Item 1</li> <p> <ol> <li>Sub A: Item 1</li> </ol> </p> </ol> </p>
Which truncates the list when encountering the first <OL_LI> after a <EM_OL_LI> tag. I am indeed using a very flat file which I am trying to add hierarchy to. PARA tags are mixed in with OL_LI tags and EM_OL_LI tags. Sample input is like:
<HEAD> <PARA> <PARA> <OL_LI> <OL_LI> <EM_OL_LI> <OL_LI> <HEAD> <PARA>
And I'm adding hierarchy through this:
<xsl:key name='stuffchildren' match="PARA | OL_LI" use="generate-id((..|preceding-sibling::HEAD)[last()])"/>
<xsl:template name="process-body"> <xsl:apply-templates select="key('stuffchildren', generate-id())"/> <xsl:apply-templates select="HEAD"/> </xsl:template>
<xsl:template match="HEAD"> <sec> <title> <xsl:apply-templates/> </title> <xsl:apply-templates select="key('stuffchildren', generate-id())"/> </sec> </xsl:template>
Which I thought could be part of my problem. But when I change it to be
<xsl:key name='stuffchildren' match="PARA | OL_LI | EM_OL_LI" use="generate-id((..|preceding-sibling::HEAD)[last()])"/>
so that it accounts for <EM_OL_LI> tags as well I get:
<p> <ol> <li>Top: Item 1</li> <p> <ol> <li>Sub A: Item 1</li> </ol> </p> </ol> </p> <p> <ol> <li>Sub A: Item1</li> </ol> </p> ...
With all of the embedded lists being repeated in separate paragraphs at the top level.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSLT 1.0: Grouping Adjace, Joe Heidenreich | Thread | RE: [xsl] XSLT 1.0: Grouping Adjace, Joe Heidenreich |
RE: [xsl] Count words and add line-, Andrew Welch | Date | RE: [xsl] XSLT 1.0: Grouping Adjace, Wendell Piez |
Month |