DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: There is something wrong in my code, please help..

  1. #1
    Thomas Guest

    There is something wrong in my code, please help..


    I can't get the link to the text to work. this is the xml:

    <?xml version="1.0" encoding="windows-1252" ?>
    <channel href="http://www.xxx.com/" base="http://www.xxx.com/">
    <item href="xxxxx">
    <title>xxx</title>
    <abstract>xxxxx.</abstract>
    </item>
    <item href="xxxx">
    <title>xxxx</title>
    <abstract>xxx</abstract>
    </item>
    </channel>

    This is the XSL:

    <?xml version="1.0" encoding="UTF-8"?><!--X-->

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/channel">
    <table>
    <xsl:for-each select="item">
    <tr>
    <td>
    <a><xsl:attribute name="href">
    <xsl:value-of select="item/href"/></xsl:attribute>
    <xsl:attribute name="target">_blank</xsl:attribute>
    <xsl:value-of select="title"/></a>
    </td>
    <td><xsl:value-of select="abstract"/></td>

    </tr>
    </xsl:for-each>
    </table>
    </xsl:template>
    </xsl:stylesheet>

  2. #2
    David Tjandra Guest

    Re: There is something wrong in my code, please help..

    Dear Thomas,

    Change your statement:
    <xsl:value-of select="item/href"/></xsl:attribute>

    into this:
    <xsl:value-of select="@href"/></xsl:attribute>

    Hope that helps,
    David Tjandra

    "Thomas" <thhmhs@hansen.tdcadsl.dk> wrote in message
    news:3d805316$1@10.1.10.29...
    >
    > I can't get the link to the text to work. this is the xml:
    >
    > <?xml version="1.0" encoding="windows-1252" ?>
    > <channel href="http://www.xxx.com/" base="http://www.xxx.com/">
    > <item href="xxxxx">
    > <title>xxx</title>
    > <abstract>xxxxx.</abstract>
    > </item>
    > <item href="xxxx">
    > <title>xxxx</title>
    > <abstract>xxx</abstract>
    > </item>
    > </channel>
    >
    > This is the XSL:
    >
    > <?xml version="1.0" encoding="UTF-8"?><!--X-->
    >
    > <xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    > <xsl:template match="/channel">
    > <table>
    > <xsl:for-each select="item">
    > <tr>
    > <td>
    > <a><xsl:attribute name="href">
    > <xsl:value-of select="item/href"/></xsl:attribute>
    > <xsl:attribute name="target">_blank</xsl:attribute>
    > <xsl:value-of select="title"/></a>
    > </td>
    > <td><xsl:value-of select="abstract"/></td>
    >
    > </tr>
    > </xsl:for-each>
    > </table>
    > </xsl:template>
    > </xsl:stylesheet>




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center