dcsimg
XSLT Problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   wendell_malpas
Posted On:   Monday, August 16, 2004 11:43 PM

Hello, Does anyone has an idea on how to solve this problem? Example, I have an XML format like this one:        translation1     translation2     translation3    How can I get the first value of the tag "trans" which is "translation1" only. currectly i'm using Any suggestions and sample code blocks is highly appreciated. Thanks, Wendell.    More>>

Hello,



Does anyone has an idea on how to solve this problem?



Example, I have an XML format like this one:





  

    translation1

    translation2

    translation3

  





How can I get the first value of the tag "trans" which is "translation1" only.



currectly i'm using






Any suggestions and sample code blocks is highly appreciated.







Thanks,



Wendell.

   <<Less

Re: XSLT Problem

Posted By:   Simon_Ablett  
Posted On:   Tuesday, August 17, 2004 09:48 AM

Depending on your exact requirements one of the following XPaths should give you what you want. Simple enough to put this into a simple template statement. The first one returns the trans element whose text contains the phrase 'translation1' (this is perhaps not of much use). The second returns the first element regardless of its content.

1: /testXML/sample/trans[text()='translation1']/text()
2: /testXML/sample/trans[position()=1]/text()

Regards.
About | Sitemap | Contact