XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
benjamin yapSubject: value of select doubt
Author: benjamin yap
Date: 06 Apr 2006 02:16 AM
i have one of the attributes in xml where it is too long to put into table. I wish to do some filtering before putting it into html table.

<attribute name="address">28 thomson road,poscode=75500</attribute>


which part of my code (below) should be modified in order to select only poscode value?


<xsl:value-of select="attribute[@name='address']"/>


looking forward for u help..thanks

Postnext
Minollo I.Subject: value of select doubt
Author: Minollo I.
Date: 06 Apr 2006 08:57 AM
You will need to work with the string value somehow; seems bad design to have "poscode" coded as part of the text node, instead of exploded in the XML structure itself...

You could do something like...
<xsl:value-of select="attribute[@name='address' and contains(.,'poscode=75500']"/>

...or you can do more sophisticated checks using other XPath functions to manipulate strings.

Minollo

Postnext
benjamin yapSubject: value of select doubt
Author: benjamin yap
Date: 06 Apr 2006 09:13 PM
hi, thanks for ur help. I followed exactly the way u mentioned below, there was no error when converting to html, but under the address column of the table, it will still select the whole adresss, instead of poscode number only...

>You will need to work with the
>string value somehow; seems
>bad design to have "poscode"
>coded as part of the text
>node, instead of exploded in
>the XML structure itself...
>
>You could do something like...
><xsl:value-of
>select="attribute[@name='addre
>ss' and
>contains(.,'poscode=75500']"/&
>gt;
>
>...or you can do more
>sophisticated checks using
>other XPath functions to
>manipulate strings.
>
>Minollo

Postnext
Minollo I.Subject: value of select doubt
Author: Minollo I.
Date: 06 Apr 2006 10:22 PM
Oh, sorry; the code I sent you selected an <attribute> element corresponding to a specific poscode; if you want to display the poscode value only, you can do something like:

<xsl:value-of select="substring-after(attribute[@name='address'],'poscode=')"/>

Posttop
benjamin yapSubject: value of select doubt
Author: benjamin yap
Date: 07 Apr 2006 10:13 AM
hi,

Thanks for ur greatest help!!Now my output is exactly what i want .....once again...thank you so so much.... :)

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.