Extraction Of Attribute value

A

AwanJohnie

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
 
B

Berislav Lopac

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


IIRC it should be

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

Joris Gillis

to trim the date:

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

AwanJohnie

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?
 
A

AwanJohnie

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

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top