[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSLT 1.0: Grouping Adjacent Elements in Embedded

Subject: RE: XSLT 1.0: Grouping Adjacent Elements in Embedded Lists
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 08 Nov 2004 12:52:39 -0500
id current
Hi Joe,

Sorry I can't diagnose the problem here, as it appears it wasn't fully specified in your earlier post (this is a way of blaming you for my guessing wrong or misreading ;-), and today it's a bit stale and crumbly.

Could you post again a small but complete instance of the scenario, including the hierarchy-interpolation you are also doing on the HEAD elements? (which *is* relevant) -- both XML source and the XSLT you have so far, with the desired result? Then I and others could all look at it fresh.

Cheers,
Wendell

At 10:33 AM 11/5/2004, you wrote:
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.