Extraction Of Attribute value

AwanJohnie

Usenet Archive
Joined
Sep 21, 2004
Messages
5
Reaction score
0
I have an xml document as shown (not mine but extracted from an application):

<category defid="468808" name="Global Information Attributes" versionid="6"> <attributeset attid="1" name="Global Information Attributes"> <attribute attid="3" name="Issue_Date" type="-7">2003-09-30T00:00:00</attribute> <attribute attid="4" name="Review_Date" type="-7">2006-10-30T00:00:00</attribute> </attributeset> </category>

I need to write an XSL to extract the values of 10 the Issue_Date (In this case = 2003-09-30T00:00:00) and Review_Date (In this case = 2006-10-30T00:00:00)

I wrote this in my xsl:

<xsl:value-of select="category/attributeset/attribute/@attid=4"/>

It did not give me the desired result. It gave me a value = true.

In addition how can I trim the date to show only "2003-09-30" for example.

Thanks
 

Joris Gillis

Usenet Archive
Joined
Sep 28, 2004
Messages
355
Reaction score
0
to trim the date:

<xsl:value-of select="
substring-before(category/attributeset/attribute[@attid=4],'T')
"/>
 

AwanJohnie

Usenet Archive
Joined
Sep 21, 2004
Messages
5
Reaction score
0
IIRC it should be

<xsl:value-of select="category/attributeset/attribute[@attid=4]" />

Thanks for your feedback but it did not return any value.

Secondly, how can I trim the date if result is obtained?
 

AwanJohnie

Usenet Archive
Joined
Sep 21, 2004
Messages
5
Reaction score
0
Goudvin Emmanuel said:
Try

<xsl:value-of select="category/attributeset/attribute[@attid='4']"/>

AwanJohnie wrote:
THANKS EVERYBODY.
IT WORKED!!!
THE ACTUAL CODES USED.....

<xsl:value-of select="substring-before(category/attributeset/attribute[@attid='3'],'T')"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,802
Members
249,594
Latest member
henrywalsh

Latest Threads

Top