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

Re: Best practices

Subject: Re: Best practices
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Jan 2004 09:53:25 -0500
xsl best practices
At 2004-01-19 15:24 +0100, SHEIKH Sajjad wrote:
In the following xml document, what is the best way to display 'id' and
'description' of element lln and 'name' of element N when
objname='Folder'?

Do you mean the way to address it in XPath? One way would be to set the context using for-each and then pick and choose what you need.


If you had prefixed text:

  <xsl:for-each select="lln[@objname='Folder']">
    <!--prefix stuff-->
    <xsl:value-of select="@id"/>
    <!--infix stuff-->
    <xsl:value-of select="@description"/>
    <!--infix stuff-->
    <xsl:value-of select="n/@name"/>
    <!--suffix stuff-->
  </xsl:for-each>

If you just wanted them grouped together, you could concatenate them with spaces (or not):

  <xsl:for-each select="lln[@objname='Folder']">
    <xsl:value-of select="concat( @id, ' ', @description, ' ', n/@name )"/>
  </xsl:for-each>

If you want to create an importable fragment with which you can specialize the processing of each of the elements by an importing stylesheet with overriding template rules:

  <xsl:for-each select="lln[@objname='Folder']">
    <!--prefix stuff-->
    <xsl:apply-templates select="@id"/>
    <!--infix stuff-->
    <xsl:apply-templates select="@description"/>
    <!--infix stuff-->
    <xsl:apply-templates select="n/@name"/>
    <!--suffix stuff-->
  </xsl:for-each>

Do you mean the way to display it in appearance? I like blue, myself.

I hope this helps!

........................ Ken

<ll>
 <lln id="123" objname="Folder" description="a folder" name="lln one
name">
  <n name="n one name"/>
 </lln>
 <lln id="131" objname="Folder" description="a folder1" name="lln one
name1">
  <n name="n one name1"/>
 </lln>
 <lln id="143" objname="Document" description="a folder2" name="lln one
name2">
  <n name="n one name2"/>
 </lln>
</ll>


--
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-03-15
-          (San Francisco, CA): 3-day XSLT/2-day XSL-FO 2004-03-22
Asia        (Hong Kong, China): 3-day XSLT/2-day XSL-FO 2004-05-17
Europe       (Bremen, Germany): 3-day XSLT/2-day XSL-FO 2004-05-24
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


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.