Welcome any assistance

Discussion in 'XML' started by Toney, Sep 24, 2005.

  1. Toney

    Toney Guest

    Definitely welcome any assistance.

    Inherited some code with an xml structure I don't think is the best. In the
    short term I have to live with what's there.

    Everything appears correctly until you mouse over the link and get a
    concantenation of all data elements, e.g.
    http://www.anydomain.com?key=1234keyimage1234.jsp09/12/2005. The data is
    located within the datagram of the parent element which also has child
    elements. With the stylesheet how do I separate out the link information
    and strip the rest? I'm sure it must be a simple solution and my brain is
    just on lock down.

    Example xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <images>
    <image>
    http://www.anydomain.com?key=1234
    <image-filename>keyimage1234.jsp</image-filename>
    <image-lastmodified>09/12/2005</image-lastmodified>
    </image>
    <image>
    http://www.anydomain.com?key=3456
    <image-filename>keyimage3456.jsp</image-filename>
    <image-lastmodified>09/22/2005</image-lastmodified>
    </image>
    <image>
    http://www.anydomain.com?key=7898
    <image-filename>keyimage7898.jsp</image-filename>
    <image-lastmodified>09/31/2005</image-lastmodified>
    </image>
    </images>


    Example xslt:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="image">
    <a href="{.}"><xsl:value-of select="image-filename"/></a> (last modified:
    <xsl:value-of select="image-lastmodified" />)<br/><br/>
    </xsl:template>

    </xsl:stylesheet>


    Example results:

    keyimage1234.jsp (last modified: 09/12/2005)

    keyimage3456.jsp (last modified: 09/22/2005)

    keyimage7898.jsp (last modified: 09/31/2005)
    Toney, Sep 24, 2005
    #1
    1. Advertising

  2. Toney

    shaun roe Guest

    In article <aJbZe.28051$hp.22037@lakeread08>,
    "Toney" <> wrote:

    > Definitely welcome any assistance.
    >
    > Inherited some code with an xml structure I don't think is the best. In the
    > short term I have to live with what's there.
    >
    > Everything appears correctly until you mouse over the link and get a
    > concantenation of all data elements, e.g.
    > http://www.anydomain.com?key=1234keyimage1234.jsp09/12/2005. The data is
    > located within the datagram of the parent element which also has child
    > elements. With the stylesheet how do I separate out the link information
    > and strip the rest? I'm sure it must be a simple solution and my brain is
    > just on lock down.
    >
    > Example xml:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <images>
    > <image>
    > http://www.anydomain.com?key=1234
    > <image-filename>keyimage1234.jsp</image-filename>
    > <image-lastmodified>09/12/2005</image-lastmodified>
    > </image>
    > <image>
    > http://www.anydomain.com?key=3456
    > <image-filename>keyimage3456.jsp</image-filename>
    > <image-lastmodified>09/22/2005</image-lastmodified>
    > </image>
    > <image>
    > http://www.anydomain.com?key=7898
    > <image-filename>keyimage7898.jsp</image-filename>
    > <image-lastmodified>09/31/2005</image-lastmodified>
    > </image>
    > </images>
    >
    >
    > Example xslt:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    > <xsl:template match="image">
    > <a href="{.}"><xsl:value-of select="image-filename"/></a> (last modified:
    > <xsl:value-of select="image-lastmodified" />)<br/><br/>
    > </xsl:template>
    >
    > </xsl:stylesheet>


    Doesnt this do what you want:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="image">
    <a href="{normalize-space(text())}"><xsl:value-of
    select="image-filename"/></a> (last modified:
    <xsl:value-of select="image-lastmodified" />)<br/><br/>
    </xsl:template>
    </xsl:stylesheet>


    >
    >
    > Example results:
    >
    > keyimage1234.jsp (last modified: 09/12/2005)
    >
    > keyimage3456.jsp (last modified: 09/22/2005)
    >
    > keyimage7898.jsp (last modified: 09/31/2005)
    shaun roe, Sep 25, 2005
    #2
    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. Andrew Clancy
    Replies:
    0
    Views:
    3,261
    Andrew Clancy
    Jul 18, 2003
  2. Replies:
    3
    Views:
    421
    Kevin Spencer
    Jul 1, 2005
  3. Brian van den Broek

    mailing list welcome welcome msg in wiki suggestion

    Brian van den Broek, Dec 12, 2004, in forum: Python
    Replies:
    0
    Views:
    582
    Brian van den Broek
    Dec 12, 2004
  4. msnews.microsoft.com

    very strange problem - any suggestions welcome.

    msnews.microsoft.com, Feb 13, 2006, in forum: ASP General
    Replies:
    0
    Views:
    88
    msnews.microsoft.com
    Feb 13, 2006
  5. Stedwick
    Replies:
    3
    Views:
    156
    ThoML
    Feb 16, 2008
Loading...

Share This Page