Extraction Of Attribute value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AwanJohnie

    Extraction Of Attribute value

    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_Dat e"
    type="-7">2003-09-30T00:00:00</attribute>
    <attribute attid="4" name="Review_Da te"
    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="categor y/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
  • Berislav Lopac

    #2
    Re: Extraction Of Attribute value

    On 30 Sep 2004 03:01:55 -0700, AwanJohnie wrote:
    [color=blue]
    > <xsl:value-of select="categor y/attributeset/attribute/@attid=4"/>[/color]


    IIRC it should be

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

    Comment

    • Joris Gillis

      #3
      Re: Extraction Of Attribute value

      to trim the date:

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

      Comment

      • AwanJohnie

        #4
        Re: Extraction Of Attribute value

        > > <xsl:value-of select="categor y/attributeset/attribute/@attid=4"/>[color=blue]
        >
        >
        > IIRC it should be
        >
        > <xsl:value-of select="categor y/attributeset/attribute[@attid=4]" />[/color]

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

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

        Comment

        • Goudvin Emmanuel

          #5
          Re: Extraction Of Attribute value

          Try

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

          AwanJohnie wrote:
          [color=blue]
          > 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_Dat e"
          > type="-7">2003-09-30T00:00:00</attribute>
          > <attribute attid="4" name="Review_Da te"
          > 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="categor y/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[/color]

          Comment

          • AwanJohnie

            #6
            Re: Extraction Of Attribute value (Thanks a Zillion)

            Goudvin Emmanuel <Emmanuel.Goudv in@voila.fr> wrote in message news:<U8Y6d.266 4$1p.2186@nntps erver.swip.net> ...[color=blue]
            > Try
            >
            > <xsl:value-of select="categor y/attributeset/attribute[@attid='4']"/>
            >
            > AwanJohnie wrote:
            >[/color]
            THANKS EVERYBODY.
            IT WORKED!!!
            THE ACTUAL CODES USED.....

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

            Comment

            Working...