Creating links using XSLT

Discussion in 'XML' started by carlosramirez, Nov 11, 2005.

  1. I'm just starting with XSLT and I'm having problems generating links.
    Here's a snippet of my xml file:

    users.xml

    <users>
    <user>
    <name>User1</name>
    <email></email>
    </user>
    ....
    </users>

    My XSL file is as follows:

    <xsl:for-each select="users/user">
    <a href="<xsl:value-of select="email" />"><xsl:value-of
    select="email"/></a>
    </xsl:for-each>

    I keep getting the error "XML Parsing Error: not well-formed" at the
    line number that contains the email.

    My question, how can I generate the following string: <a
    href="mailto:$email">$email</a>

    Thanks.

    -Carlos
     
    carlosramirez, Nov 11, 2005
    #1
    1. Advertising

  2. In <kJVcf.80079$An6.78148@trnddc08>, carlosramirez wrote:

    > <users>
    > <user>
    > <name>User1</name>
    > <email></email>
    > </user>
    > ...
    > </users>
    >
    > My XSL file is as follows:
    >
    > <xsl:for-each select="users/user">
    > <a href="<xsl:value-of select="email" />"><xsl:value-of
    > select="email"/></a>


    <a href="mailto:{email}"><xsl:value-of> select="email" /></a>

    --
    |":._.:"| http://habett.com/
    | (=) | http://habett.org/
    \...:.../ Iyonix - PC - iBook
     
    Stephane Roux (HAbeTT), Nov 11, 2005
    #2
    1. Advertising

  3. In <>, Stephane Roux (HAbeTT)
    wrote:

    > In <kJVcf.80079$An6.78148@trnddc08>, carlosramirez wrote:
    >
    >> <users>
    >> <user>
    >> <name>User1</name>
    >> <email></email>
    >> </user>
    >> ...
    >> </users>
    >>
    >> My XSL file is as follows:
    >>
    >> <xsl:for-each select="users/user">
    >> <a href="<xsl:value-of select="email" />"><xsl:value-of
    >> select="email"/></a>

    >
    > <a href="mailto:{email}"><xsl:value-of> select="email" /></a>


    <a href="mailto:{email}"><xsl:value-of select="email" /></a>

    --
    |":._.:"| http://habett.com/
    | (=) | http://habett.org/
    (..'|'..) Birthdays are the cult of growing old
     
    Stephane Roux (HAbeTT), Nov 11, 2005
    #3
  4. Stephane Roux (HAbeTT) wrote:
    > In <kJVcf.80079$An6.78148@trnddc08>, carlosramirez wrote:
    >
    >
    >><users>
    >><user>
    >><name>User1</name>
    >><email></email>
    >></user>
    >>...
    >></users>
    >>
    >>My XSL file is as follows:
    >>
    >><xsl:for-each select="users/user">
    >> <a href="<xsl:value-of select="email" />"><xsl:value-of
    >>select="email"/></a>

    >
    >
    > <a href="mailto:{email}"><xsl:value-of> select="email" /></a>
    >


    Thanks!
     
    carlosramirez, Nov 11, 2005
    #4
  5. carlosramirez

    JAPISoft Guest

    Try this :

    <xsl:element name="a">
    <xsl:attribute name="href">
    <xsl:value-of select="email" />
    </xsl:attribute>
    </xsl:element>

    Best regards,

    A.Brillant
    EditiX - XML Editor and XSLT Debugger
    http://www.editix.com


    Stephane Roux (HAbeTT) wrote:
    > In <kJVcf.80079$An6.78148@trnddc08>, carlosramirez wrote:
    >
    >
    >><users>
    >><user>
    >><name>User1</name>
    >><email></email>
    >></user>
    >>...
    >></users>
    >>
    >>My XSL file is as follows:
    >>
    >><xsl:for-each select="users/user">
    >> <a href="<xsl:value-of select="email" />"><xsl:value-of
    >>select="email"/></a>

    >
    >
    > <a href="mailto:{email}"><xsl:value-of> select="email" /></a>
    >
     
    JAPISoft, Nov 12, 2005
    #5
    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. www.westerncartooncards.ca

    Exchange Links < Western Cartoon Cards > Exchange Links

    www.westerncartooncards.ca, Jul 12, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,291
    Toby Inkster
    Jul 12, 2004
  2. SDM
    Replies:
    2
    Views:
    574
  3. Jurrie
    Replies:
    0
    Views:
    531
    Jurrie
    Oct 6, 2003
  4. Replies:
    2
    Views:
    739
    Henry S. Thompson
    Oct 19, 2005
  5. Garrett Smith
    Replies:
    14
    Views:
    340
    David Mark
    May 26, 2009
Loading...

Share This Page