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

RE: Annoying problem

Subject: RE: Annoying problem
From: Mark Hayes <mark@xxxxxxxxxxx>
Date: Tue, 23 Nov 1999 20:36:30 -0800
xsl section of siblings
<xsl:number> was made for this.  

>From this source:

<section>
  <section>
    <section/>
    <section/>
  </section>
  <section>
    <section/>
    <section/>
  </section>
</section>

This stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="section">
    <section>
      <xsl:number level="multiple" format="1.1"/>
      <xsl:apply-templates/>
    </section>
  </xsl:template>
</xsl:stylesheet>

Produces this output:

<?xml version="1.0" encoding="utf-8"?>
<section>1
  <section>1.1
    <section>1.1.1</section>
    <section>1.1.2</section>
  </section>
  <section>1.2
    <section>1.2.1</section>
    <section>1.2.2</section>
  </section>
</section>

--
mark

> -----Original Message-----
> From: disco [mailto:disco@xxxxxxxxxxxxxxx]
> Sent: Tuesday, November 23, 1999 7:05 PM
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: Annoying problem
> 
> 
> Hi,
> 
> This is an annoying problem which will hopefully be less 
> annoying to those
> of you who haven't been banging your heads against it for the past few
> hours:
> 
> I'm writing a transformation for my thesis, from XML to HTML. 
> Part of the
> DTD states that sections may nest recursively within 
> sections. Given any
> one of these sections or subsections as a context node, I'd like to be
> able to generate a "tumbler" for that node. For example:
> 
> <section> <!-- 1 -->
>  <section> <!-- 1.1 --> </section>
>  <section> <!-- 1.2 -->
>   <section> <!-- 1.2.1 --> </section>
>   <section> <!-- 1.2.2 --> </section>
>  </section>
>  <section> <!-- 1.3 --> </section>
> </section>
> <section> <!-- 2 --> </section>
> 
> I have been trying a lisp-style approach: given a "section" 
> node, find its
> position relative to its section siblings, and concatenate 
> that value (as
> a string) with that of its parent, and so forth until the parent is no
> longer a section node. While I'm fairly convinced this is the correct
> approach, I haven't been able to get it to work. I'd say I know XSLT
> and XPath fairly well but many intricacies of the languages 
> are still new
> to me, so this is somewhat aggravating...
> 
> Any help or ideas would be much appreciated.
> 
> Thanks,
> Dan
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread
  • Annoying problem
    • disco - Tue, 23 Nov 1999 22:04:51 -0500 (EST)
      • <Possible follow-ups>
      • Mark Hayes - Tue, 23 Nov 1999 20:36:30 -0800 <=

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.