XSLT help. This hurts.

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

    XSLT help. This hurts.

    I have an xml document that I am trying to transform into HTML. This
    sounds straigt forward but the xml uses an format that I don't know
    how to xslt. Here is the format.

    <RESULTSET>
    <HIT>
    <FIELD NAME="contentty pe">text/html</FIELD>
    <FIELD NAME="language" >en</FIELD>
    <FIELD NAME="charset"> iso-8859-1</FIELD>
    <FIELD NAME="urls">/wed/dd/Cwebwire-bac_gen.6898.ht ml</FIELD>
    </HIT>
    <HIT>
    </HIT>
    </RESULTSET>

    I think this is poorly written XML but I have no choice. I need to
    get the data from the entity <FIELD> but I only need specific ones.
    For example I need to grab the data from <FIELD NAME="urls"> but I
    don't know how to address it specifically. Now you ask why did this
    application decide that using the same xml entity over and over again,
    I could not tell you. A <URL> entity would have worked just fine.
    Thanks ahead of time for your help.

    So how do I grab "/wed/dd/Cwebwire-bac_gen.6898.ht ml" from <FIELD
    NAME="urls"> I have already tried <xsl:value-of select="@headin gs"/>.
    Any help would be greatly appreciated.

    Brett
  • Kimanzi Mati

    #2
    Re: XSLT help. This hurts.

    RESULTSET/HIT/FIELD/[@NAME='urls'] will get you the FIELD element you are
    looking for. To get the text contained in it you can use the text()
    function.


    "Brett conklin" <bconklin@senti us.com> wrote in message
    news:e1f2f028.0 310011620.42ca9 7f5@posting.goo gle.com...[color=blue]
    > I have an xml document that I am trying to transform into HTML. This
    > sounds straigt forward but the xml uses an format that I don't know
    > how to xslt. Here is the format.
    >
    > <RESULTSET>
    > <HIT>
    > <FIELD NAME="contentty pe">text/html</FIELD>
    > <FIELD NAME="language" >en</FIELD>
    > <FIELD NAME="charset"> iso-8859-1</FIELD>
    > <FIELD NAME="urls">/wed/dd/Cwebwire-bac_gen.6898.ht ml</FIELD>
    > </HIT>
    > <HIT>
    > </HIT>
    > </RESULTSET>
    >
    > I think this is poorly written XML but I have no choice. I need to
    > get the data from the entity <FIELD> but I only need specific ones.
    > For example I need to grab the data from <FIELD NAME="urls"> but I
    > don't know how to address it specifically. Now you ask why did this
    > application decide that using the same xml entity over and over again,
    > I could not tell you. A <URL> entity would have worked just fine.
    > Thanks ahead of time for your help.
    >
    > So how do I grab "/wed/dd/Cwebwire-bac_gen.6898.ht ml" from <FIELD
    > NAME="urls"> I have already tried <xsl:value-of select="@headin gs"/>.
    > Any help would be greatly appreciated.
    >
    > Brett[/color]


    Comment

    • Dimitre Novatchev

      #3
      Re: XSLT help. This hurts.

      > So how do I grab "/wed/dd/Cwebwire-bac_gen.6898.ht ml" from <FIELD[color=blue]
      > NAME="urls">[/color]

      string(/*/*/FIELD[@NAME='urls'])


      =====
      Cheers,

      Dimitre Novatchev.
      http://fxsl.sourceforge.net/ -- the home of FXSL

      "Brett conklin" <bconklin@senti us.com> wrote in message
      news:e1f2f028.0 310011620.42ca9 7f5@posting.goo gle.com...[color=blue]
      > I have an xml document that I am trying to transform into HTML. This
      > sounds straigt forward but the xml uses an format that I don't know
      > how to xslt. Here is the format.
      >
      > <RESULTSET>
      > <HIT>
      > <FIELD NAME="contentty pe">text/html</FIELD>
      > <FIELD NAME="language" >en</FIELD>
      > <FIELD NAME="charset"> iso-8859-1</FIELD>
      > <FIELD NAME="urls">/wed/dd/Cwebwire-bac_gen.6898.ht ml</FIELD>
      > </HIT>
      > <HIT>
      > </HIT>
      > </RESULTSET>
      >
      > I think this is poorly written XML but I have no choice. I need to
      > get the data from the entity <FIELD> but I only need specific ones.
      > For example I need to grab the data from <FIELD NAME="urls"> but I
      > don't know how to address it specifically. Now you ask why did this
      > application decide that using the same xml entity over and over again,
      > I could not tell you. A <URL> entity would have worked just fine.
      > Thanks ahead of time for your help.
      >
      > So how do I grab "/wed/dd/Cwebwire-bac_gen.6898.ht ml" from <FIELD
      > NAME="urls"> I have already tried <xsl:value-of select="@headin gs"/>.
      > Any help would be greatly appreciated.
      >
      > Brett[/color]


      Comment

      • Andy Fish

        #4
        Re: XSLT help. This hurts.

        it's _supposed_ to hurt - Welcome to XSLT ;-))

        "Brett conklin" <bconklin@senti us.com> wrote in message
        news:e1f2f028.0 310011620.42ca9 7f5@posting.goo gle.com...[color=blue]
        > I have an xml document that I am trying to transform into HTML. This
        > sounds straigt forward but the xml uses an format that I don't know
        > how to xslt. Here is the format.
        >
        > <RESULTSET>
        > <HIT>
        > <FIELD NAME="contentty pe">text/html</FIELD>
        > <FIELD NAME="language" >en</FIELD>
        > <FIELD NAME="charset"> iso-8859-1</FIELD>
        > <FIELD NAME="urls">/wed/dd/Cwebwire-bac_gen.6898.ht ml</FIELD>
        > </HIT>
        > <HIT>
        > </HIT>
        > </RESULTSET>
        >
        > I think this is poorly written XML but I have no choice. I need to
        > get the data from the entity <FIELD> but I only need specific ones.
        > For example I need to grab the data from <FIELD NAME="urls"> but I
        > don't know how to address it specifically. Now you ask why did this
        > application decide that using the same xml entity over and over again,
        > I could not tell you. A <URL> entity would have worked just fine.
        > Thanks ahead of time for your help.
        >
        > So how do I grab "/wed/dd/Cwebwire-bac_gen.6898.ht ml" from <FIELD
        > NAME="urls"> I have already tried <xsl:value-of select="@headin gs"/>.
        > Any help would be greatly appreciated.
        >
        > Brett[/color]


        Comment

        • Brett conklin

          #5
          Re: XSLT help. This hurts.

          I have noticed. Man this was much easier in Perl. But I will prevail.



          "Andy Fish" <ajfish@blueyon der.co.uk> wrote in message news:<yXYeb.695 4$ii2.57427122@ news-text.cableinet. net>...[color=blue]
          > it's _supposed_ to hurt - Welcome to XSLT ;-))
          >
          > "Brett conklin" <bconklin@senti us.com> wrote in message
          > news:e1f2f028.0 310011620.42ca9 7f5@posting.goo gle.com...[color=green]
          > > I have an xml document that I am trying to transform into HTML. This
          > > sounds straigt forward but the xml uses an format that I don't know
          > > how to xslt. Here is the format.
          > >
          > > <RESULTSET>
          > > <HIT>
          > > <FIELD NAME="contentty pe">text/html</FIELD>
          > > <FIELD NAME="language" >en</FIELD>
          > > <FIELD NAME="charset"> iso-8859-1</FIELD>
          > > <FIELD NAME="urls">/wed/dd/Cwebwire-bac_gen.6898.ht ml</FIELD>
          > > </HIT>
          > > <HIT>
          > > </HIT>
          > > </RESULTSET>
          > >
          > > I think this is poorly written XML but I have no choice. I need to
          > > get the data from the entity <FIELD> but I only need specific ones.
          > > For example I need to grab the data from <FIELD NAME="urls"> but I
          > > don't know how to address it specifically. Now you ask why did this
          > > application decide that using the same xml entity over and over again,
          > > I could not tell you. A <URL> entity would have worked just fine.
          > > Thanks ahead of time for your help.
          > >
          > > So how do I grab "/wed/dd/Cwebwire-bac_gen.6898.ht ml" from <FIELD
          > > NAME="urls"> I have already tried <xsl:value-of select="@headin gs"/>.
          > > Any help would be greatly appreciated.
          > >
          > > Brett[/color][/color]

          Comment

          Working...