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

applying templates to ancestor nodes without reprocess

Subject: applying templates to ancestor nodes without reprocessing context node
From: Jarom McDonald <jmcdon@xxxxxxxxxxxx>
Date: Wed, 10 Apr 2002 13:13:48 -0400
app rdg
I've been searching for a week or so and haven't found an answer to this
question, so I thought I'd try posting it. If it's already been
discussed in the past, please direct me to the proper archive.

I'm trying to write a stylesheet for some documents encoded with the TEI
dtd, and am running into a problem. Here is the xml:

<l n="1">There are two Ripenings
    <app>
      <rdg wit="A456 H47"> -</rdg>
      <rdg wit="ATr60a"></rdg>
    </app></l>
    <l n="2">
    <app>
      <rdg wit="A456">one -</rdg>
      <rdg wit="H47">One -</rdg>
      <rdg wit="ATr60a">one</rdg>
    </app> of
    <app>
      <rdg wit="A456">sight -</rdg>
      <rdg wit="H47">Sight - whose Forces</rdg>
      <rdg wit="ATr60a">sight</rdg>
    </app></l>

I want the stylesheet to process each <rdg> element and produce HTML
<div> elements that have corresponding "wit" attributes, but whose
content contains first the content of the xml <l> element (which should
appear in all the HTML <div>s), followed by the specific content of the
current <rdg> element. Here's where I've begun:

<xsl:template match="app" mode="parallel-segmentation">
<xsl:for-each select="rdg">
<div id="line">
<xsl:attribute name="wit"><xsl:value-of select="@wit"/></xsl:attribute>
<xsl:apply-templates/>
</div>
</xsl:for-each>
</xsl:template>

This obviously works for getting just the content of the <rdg> elements.
So here's my question. Before applying the templates to the children of
the <rdg> element (many will have children, though my example doesn't),
I want to process the ancestor <l> element and all of its children
(again, many will have them, though my example doesn't) EXCEPT <app>
(and hence decendant <rdg>) elements. Basically, I want the resultant
HTML to look like this:

<div id="line" wit="A456 H47">There are two Ripenings -</div>
<div id="line" wit="ATr60a">There are two Ripenings</div>
<div id="line" wit="A456">one -</div>
<div id="line" wit="H47">One -</div>
<div id="line" wit="ATr60a">one</div>
<div id="line" wit="A456">of sight -</div>
<div id="line" wit="H47">of Sight - whose Forces</div
<div id="line" wit="ATr60a">of sight</div>

I've tried putting this line into my <app> template:

<xsl:apply-templates select="node()[ancestor::l]" mode="noApps"/>

and then having a new template that looks like this:

<xsl:template name="l" mode="noApps">
<xsl:apply-templates select="node()[not(self::app)]"/>
</xsl:template>

But that, in actuality, re-processes the child <app> elements without
processing any of the other children.

Hope my question makes sense. Sorry the post is so long.

--
Jarom McDonald
Project Manager
Dickinson Electronic Archives
http://jefferson.village.virginia.edu/dickinson
jmcdon@xxxxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.