How can I concatenate this?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zhou Lei

    How can I concatenate this?


    I'm write an .xsl to transform an .xml to xhtml file, and an xml fragment is
    like this:

    <user login="codename ">
    <link target="http://www.my.addr.com/~codename" />
    James Cook
    </link>
    </user>

    I want to display "codename@my.ad dr.com" as the email address, so I write the
    following xsl to achieve this:

    ....
    <xsl:template match="user">
    Name:
    <xsl:apply-templates select="link" />
    <br/>
    Email:
    <xsl:value-of select="@login" />
    @my.addr.com
    </xsl:template>

    <xsl:template match="link">
    <a href="{@target} ">
    <xsl:value-of select="." />
    </a>
    </xsl:template>

    But there's a space between username and the domain name in mail address. Can I
    fix it? Thank you.
  • Joris Gillis

    #2
    Re: How can I concatenate this?

    Tempore 04:36:03, die Saturday 26 February 2005 AD, hinc in foro {comp.text.xml} scripsit Zhou Lei <dark_eaglet@ho tmail.com>:
    [color=blue]
    > <xsl:template match="user">
    > Name:
    > <xsl:apply-templates select="link" />
    > <br/>
    > Email:
    > <xsl:value-of select="@login" />
    > @my.addr.com
    > </xsl:template>[/color]
    [color=blue]
    > But there's a space between username and the domain name in mail address. Can I
    > fix it? Thank you.[/color]
    Hi,

    The whitespace appears in the result because it is there in the xslt.

    Write: <xsl:value-of select="@login" />@my.addr.com
    or:
    <xsl:value-of select="@login" />
    <xsl:text>@my.a ddr.com</xsl:text>

    or: <xsl:value-of select="concat( @login,'@my.add r.com')" />

    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
    "Φιλήκοο ν ειναι μαλλον η φιλόλαλΠ¿Î½" - ΚλεόβουΠ»Î¿Ï‚

    Comment

    • Zhou Lei

      #3
      Re: How can I concatenate this?


      Thank you for your help! And I'm learning to write a transform file but really I
      got some problems, one of them is that my xsl file works fine in IE 6, but
      firefox 1.0 says: Error loading stylesheet: An XSLT stylesheet does not have an
      XML mimetype. The beginning of my xsl file is here:

      <?xml version="1.0"?>
      <xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">

      I'm really confused why this happens.

      Regards,

      Comment

      • Joris Gillis

        #4
        Re: How can I concatenate this?

        Tempore 06:30:18, die Saturday 26 February 2005 AD, hinc in foro {comp.text.xml} scripsit Zhou Lei <dark_eaglet@ho tmail.com>:
        [color=blue]
        >
        > Thank you for your help! And I'm learning to write a transform file but really I
        > got some problems, one of them is that my xsl file works fine in IE 6, but
        > firefox 1.0 says: Error loading stylesheet: An XSLT stylesheet does not have an
        > XML mimetype. The beginning of my xsl file is here:
        > I'm really confused why this happens.[/color]
        I don;t know what a mimetype is, so I can't really help you with this.
        I can only point you to this:
        An XSLTProcessor applies an XSLT stylesheet transformation to an XML document to produce a new XML document as output. It has methods to load the XSLT stylesheet, to manipulate parameter values, and to apply the transformation to documents.


        regards,
        --
        Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
        "Φιλήκοο ν ειναι μαλλον η φιλόλαλΠ¿Î½" - ΚλεόβουΠ»Î¿Ï‚

        Comment

        • Zhou Lei

          #5
          Re: How can I concatenate this?


          Ok, I'll check it. Anyway, thanks for your help.

          Comment

          • Andy Dingley

            #6
            Re: How can I concatenate this?

            It was somewhere outside Barstow when Zhou Lei
            <dark_eaglet@ho tmail.com> wrote:
            [color=blue]
            >
            >Thank you for your help! And I'm learning to write a transform file but really I
            >got some problems, one of them is that my xsl file works fine in IE 6, but
            >firefox 1.0 says: Error loading stylesheet: An XSLT stylesheet does not have an
            >XML mimetype.[/color]

            The web server needs to serve the XSLT document(s) as application/xml
            or text/xml rather than text/html This should be a minor
            configuration change on the web server.

            Secondly, I suggest _not_ using XSLT on the client side - thansform it
            on the server and serve the results as plain HTML. It's great when it
            works, but it can't be used by so many users that it's often best
            avoided.

            Comment

            • Zhou Lei

              #7
              Re: How can I concatenate this?


              Thank you for your help. But
              [color=blue]
              >The web server needs to serve the XSLT document(s) as application/xml
              >or text/xml rather than text/html This should be a minor
              >configuratio n change on the web server.[/color]

              How can I do it?

              I'll use cocoon later but I want my firefox works fine also.

              Comment

              • Andy Dingley

                #8
                Re: How can I concatenate this?

                It was somewhere outside Barstow when Zhou Lei
                <dark_eaglet@ho tmail.com> wrote:
                [color=blue]
                >How can I do it?[/color]

                Look at the documentation for the web server you're using.

                I don't know which one you're using, so I can't tell you more than
                this.

                Comment

                Working...