Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old October 2nd, 2008, 03:56 AM
Newbie
 
Join Date: Sep 2008
Posts: 18
Default xsl for a given xml

Hi,

XML:


<richtext xmlns:sgx="http://www.lotus.com/dxl">
<pardef id="2" leftmargin="1in" rightmargin="100%" keeptogether="true" />
<par def="2">Name of director : Chan Siew Key Steven</par>
<par def="2" />
<par def="2">Date of notice to company : 23 September 1997</par>
<par def="2" />
<par def="2">Date of change of shareholding : 21 August 1997</par>
<par def="2" />
<par def="2">Name of registered holder : Chan Siew Key Steven</par>
<par def="2" />
<par def="2">Circumstance given rise to the change : Share option granted.</par>
<par def="2" />
<par def="2">No. of options of the change : 40,000</par>

</richtext>


xsl one :

<xsl:for-each select="par[@def='2']>
<xsl:value-of select="."></xsl:value-of>
<br />
</xsl:for-each>

xsl two:

<xsl:for-each select="par[@def='2']">
<xsl:value-of select="par[@def='2']"></xsl:value-of>
<br />
</xsl:for-each>

whats the difference between these two xsl's..
why xsl two doesnt give any out put ..i mean same like xsl one.


Thanks in advance..
Raj
Reply
  #2  
Old October 2nd, 2008, 04:58 AM
Dormilich's Avatar
Expert
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 31
Posts: 673
Default

Quote:
Originally Posted by sgxbytes
why xsl two doesnt give any out put ..i mean same like xsl one.
actually, no. both are different. in the first xsl you access the same node as defined in the loop ( . = self::node() ), whereas in the second xsl you access the <par> (value-of) that is a child of <par> (for-each), only that there is no such node, ergo no value (the <xsl:value-of> is looking for "par[@def='2']/par[@def='2']" so to speak)

regards
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles