How can I concatenate this?

J

Joris Gillis

Tempore 04:36:03 said:
<xsl:template match="user">
Name:
<xsl:apply-templates select="link" />
<br/>
Email:
<xsl:value-of select="@login" />
@my.addr.com
</xsl:template>
But there's a space between username and the domain name in mail address. Can I
fix it? Thank you.
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.addr.com</xsl:text>

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

regards,
 
J

Joris Gillis

Tempore 06:30:18 said:
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.
I don;t know what a mimetype is, so I can't really help you with this.
I can only point you to this:
http://www.mozilla.org/projects/xslt/faq.html

regards,
 
Z

Zhou Lei

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 "(e-mail address removed)" 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.
 
Z

Zhou Lei

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:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

I'm really confused why this happens.

Regards,
 
A

Andy Dingley

It was somewhere outside Barstow when Zhou Lei
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 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.
 
Z

Zhou Lei

Thank you for your help. But
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.

How can I do it?

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

Andy Dingley

It was somewhere outside Barstow when Zhou Lei
How can I do it?

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top