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

Simple list numbering problem with rule based styleshe

Subject: Simple list numbering problem with rule based stylesheet approach
From: Jacobus Reyneke <jacobusreyneke@xxxxxxxxx>
Date: Thu, 22 Apr 2010 17:49:55 +0200
 Simple list numbering problem with rule based styleshe
Good day,

I'm just looking for a bit of mentoring advice if somebody has a
moment to help. This is more of a "how to do it right" than just a
"how to do it" question.

My biggest problem with XSLT is combining different stylesheet
pattens, such as rule based and navigational based. I'm curretnly
stuck on how to extend the stylesheet below to one that allows
numbered items also.

Input XML:
   <gl:item>Select province: Western Cape</gl:item>
   <gl:item>Select Town: Cape Town</gl:item>
   <gl:item>Property Type: House</gl:item>
   <gl:item>Min Price: 500 000</gl:item>
   <gl:item>Max Price: 1000 000</gl:item>

Current XSL:
    <xsl:template match="gl:list">
            <xsl:apply-templates select="gl:item"/>
    <xsl:template match="gl:item">
        <fo:list-item margin-left="20">
            <fo:list-item-label end-indent="label-end()">
                <fo:block font-family="ZapfDingbats">b</fo:block>
            <fo:list-item-body start-indent="body-start()">

The output of this currently puts little check marks next to each list item.

I would like to support a new type of element, lets call it
<gl:numbered-item> which will have the item number instead of a check
box in front of it. So for each list with numbered items in it, the
XSL will need to calculate the position of the sibling under the
parent list. Can and should this be done that way? Is the rule based
template approach the right way to do this type of thing, or am I
writing bad code? I get the feeling I should approach this differently
with a for-each type of solution, but did not want to tackle lists one
way for numbered items an another way for bulleted items.

I'm trying to get into the habit of writing re-usable, extendable and
modular XSL, but it's just me, myself and a bunch of text books alone
on a farm, so sometimes I wonder if I'm not barking up the wrong tree.

Kind regards,
"Trust God"
"Be good, be nice, be happy"
"Sleep like a dolphin"

Current Thread


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.
First Name
Last Name
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.