[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Best practices


Subject: RE: [xsl] Best practices
From: "SHEIKH Sajjad" <Sajjad.SHEIKH@xxxxxxxxxxx>
Date: Tue, 20 Jan 2004 14:12:27 +0100

What I meant was the inexpensive way of processing all the nodes.
Since I have plenty of xml documents which will be processed.  If my
template match is going to whole tree, obviously it will take time and
finally it will impact on the performance.

Thanks to both of you for response.

Regards,
/s

-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
Sent: 19 January 2004 15:53
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [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


______________________________________________________________
This message has been scanned for all viruses by BTnet VirusScreen. The
service is delivered in partnership with MessageLabs.

This service does not scan any password protected or encrypted
attachments.  

If you are interested in finding out more about the service, please
visit our website at
http://www.btignite.com/internetservices/btnet/products_virusscreen.htm
==============================================================

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



Current Thread
Keywords