DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Aaron Guest

    Ignore previous one: How: Populate table of URLs from an XML using XSLT


    This is a corrected posting. Please ignore my previous posting.

    I just started XML. I searched for help for this problem but could not find
    one specific to this.

    This is the problem.

    I have a an XML file with a list of URLs.
    I could take that data and paint a simple HTML table using XSLT.
    The problem occurs when I want the each URL to be present inside a quote
    as a value for the HREF attribute to form an HTML anchor.

    In other words how do I put URL part from XML using XSLT in the construct
    below:

    <A HREF="URL"> hello </A>

    I know, the syntax isn't correct if I replace the URL part with <xsl: value-of
    select="url">.

    Then how do I "put" a value there?

    Hope some one knows a way out.

    Thanks,
    Aaron




  2. #2
    Russell Jones Guest

    Re: Ignore previous one: How: Populate table of URLs from an XML using XSLT

    "Aaron " <aaronsandy@yahoo.com> wrote in message
    news:3aaffaa9$1@news.devx.com...
    >
    > In other words how do I put URL part from XML using XSLT in the construct
    > below:
    >
    > <A HREF="URL"> hello </A>



    There are two solutions:

    1. <a><xsl:attribute name="href"><xsl:value-of
    select="url"/></xsl:attribute>Link title</a>

    2. <a href="{url}">Link title</a>




  3. #3
    Aaron Guest

    Re: Ignore previous one: How: Populate table of URLs from an XML using XSLT



    I tried your solution. It just simply works.
    Thanks you so much Russell.


    "Russell Jones" <arj1@northstate.net> wrote:
    >"Aaron " <aaronsandy@yahoo.com> wrote in message
    >news:3aaffaa9$1@news.devx.com...
    >>
    >> In other words how do I put URL part from XML using XSLT in the construct
    >> below:
    >>
    >> <A HREF="URL"> hello </A>

    >
    >
    >There are two solutions:
    >
    >1. <a><xsl:attribute name="href"><xsl:value-of
    >select="url"/></xsl:attribute>Link title</a>
    >
    >2. <a href="{url}">Link title</a>
    >
    >
    >



  4. #4
    bryan Guest

    Re: Ignore previous one: How: Populate table of URLs from an XML using XSLT


    "Aaron " <aaronsandy@yahoo.com> wrote:
    >

    how do I put URL part from XML using XSLT in the construct
    >below:
    >
    ><A HREF="URL"> hello </A>
    >
    >I know, the syntax isn't correct if I replace the URL part with <xsl: value-of
    >select="url">.
    >
    >Then how do I "put" a value there?
    >
    >Hope some one knows a way out.
    >
    >Thanks,
    >Aaron
    >


    I might not be understanding the problem correctly but I'd do something like
    the following
    <xsl:template match="a"><a><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of
    select="."/></a></xsl:template>
    or you could, if you want to include a lot of html in your output, and of
    course depending on parser used, declare your html as a namespace. I generally
    don't like that however cause I think it decreases reusability of stylesheets
    between media.


Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links