href values and value-of

Discussion in 'XML' started by Dante, Sep 30, 2004.

  1. Dante

    Dante Guest

    Hello. I am creating an xml list of links with structure like the
    below:

    <item>
    <title>Bullet Madness</title>
    <uri>http://www.stylegala.com/archive/bulletmadness/</uri>
    <description>200 bullets, each of them nice in their own
    way</description>
    </item>

    I need to create a link with that data. When I tried to do something
    like
    <a href="<xsl:value-of select="uri">">text</a>

    I got the error that the structure was not well formed. How else would
    I create a link with proper structure?

    Thanks, Dante
     
    Dante, Sep 30, 2004
    #1
    1. Advertising

  2. Dante (29 Sep 2004 20:46:59 -0700):
    > <item>
    > <title>Bullet Madness</title>
    > <uri>http://www.stylegala.com/archive/bulletmadness/</uri>
    > <description>200 bullets, each of them nice in their own
    > way</description>
    > </item>
    >
    > I need to create a link with that data. When I tried to do something
    > like
    > <a href="<xsl:value-of select="uri">">text</a>


    <a>
    <xsl:attribute><xsl:value-of select="uri"/></xsl:attribute>
    text
    </a>

    Chris
    --
    Chris Huebsch www.hübsch-gemacht.de | TU Chemmnitz, Informatik, RNVS
    GPG-Encrypted mail welcome! ID:7F2B4DBA | Str. d. Nationen 62, B204
    Chemnitzer Linux-Tage 2005, 5.-6.März | D-09107 Chemnitz
    http://chemnitzer.linux-tage.de/ | +49 371 531-1377, Fax -1803
     
    Chris Huebsch, Sep 30, 2004
    #2
    1. Advertising

  3. Dante () wrote:
    : Hello. I am creating an xml list of links with structure like the
    : below:

    : <item>
    : <title>Bullet Madness</title>
    : <uri>http://www.stylegala.com/archive/bulletmadness/</uri>
    : <description>200 bullets, each of them nice in their own
    : way</description>
    : </item>

    : I need to create a link with that data. When I tried to do something
    : like
    : <a href="<xsl:value-of select="uri">">text</a>

    : I got the error that the structure was not well formed. How else would
    : I create a link with proper structure?


    Something like

    &lt;a href="<xsl:value-of select="uri">"&gt; text &lt;/a&gt;
     
    Malcolm Dew-Jones, Sep 30, 2004
    #3
  4. In article <-chemnitz.de>,
    Chris Huebsch <-chemnitz.de> wrote:

    >> <a href="<xsl:value-of select="uri">">text</a>


    ><a>
    > <xsl:attribute><xsl:value-of select="uri"/></xsl:attribute>
    > text
    ></a>


    You forgot the attribute name:

    <xsl:attribute name="href"><xsl:value-of select="uri"/></xsl:attribute>

    There's a shorthand for attribute values:

    <a href="{uri}">text</a>

    See "attribute-value-templates" in the XSLT spec.

    -- Richard
     
    Richard Tobin, Sep 30, 2004
    #4
  5. Richard Tobin (30 Sep 2004 11:02:49 GMT):
    > You forgot the attribute name:


    oh. yes. you are right. Thank you.

    > <a href="{uri}">text</a>


    this looks most elegant.


    Chris
    --
    Chris Huebsch www.hübsch-gemacht.de | TU Chemmnitz, Informatik, RNVS
    GPG-Encrypted mail welcome! ID:7F2B4DBA | Str. d. Nationen 62, B204
    Chemnitzer Linux-Tage 2005, 5.-6.März | D-09107 Chemnitz
    http://chemnitzer.linux-tage.de/ | +49 371 531-1377, Fax -1803
     
    Chris Huebsch, Sep 30, 2004
    #5
  6. Dante

    Joris Gillis Guest

    ....or use the shortest notation:

    <a href="{uri}">text</a>


    Joris Gillis
     
    Joris Gillis, Sep 30, 2004
    #6
  7. Dante

    Dante Guest

    Chris Huebsch <-chemnitz.de> wrote in message
    > <a>
    > <xsl:attribute><xsl:value-of select="uri"/></xsl:attribute>
    > text
    > </a>
    >
    > Chris



    Wouldn't you have to specify the attribute, by doing
    <xsl:attribute="href"><xsl:value-of select="uri"/></xsl:attribute>
    ?

    Dante
     
    Dante, Sep 30, 2004
    #7
  8. Dante (30 Sep 2004 08:59:31 -0700):
    > Wouldn't you have to specify the attribute, by doing
    > <xsl:attribute="href"><xsl:value-of select="uri"/></xsl:attribute>
    > ?


    as others stated already

    <xsl:attribute name="href">....


    Chris
    --
    Chris Huebsch www.hübsch-gemacht.de | TU Chemmnitz, Informatik, RNVS
    GPG-Encrypted mail welcome! ID:7F2B4DBA | Str. d. Nationen 62, B204
    Chemnitzer Linux-Tage 2005, 5.-6.März | D-09107 Chemnitz
    http://chemnitzer.linux-tage.de/ | +49 371 531-1377, Fax -1803
     
    Chris Huebsch, Sep 30, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CRON
    Replies:
    24
    Views:
    200,805
    Adrienne Boswell
    Jun 20, 2006
  2. Soren Vejrum
    Replies:
    4
    Views:
    616
    Lasse Reichstein Nielsen
    Jul 5, 2003
  3. saiho.yuen
    Replies:
    3
    Views:
    431
    kaeli
    Sep 14, 2004
  4. Replies:
    2
    Views:
    473
  5. Vincent van Beveren

    BASE HREF and A HREF="#" onclick="..."

    Vincent van Beveren, Jul 6, 2006, in forum: Javascript
    Replies:
    2
    Views:
    323
    Vincent van Beveren
    Jul 6, 2006
Loading...

Share This Page