Jump to content

Problem Trying to Output Variable Text


SteveMurphy

Recommended Posts

I have a style sheet in which I'm trying to ouput a couple of entities and the value of a variable. Following is my code:

<xsl:variable name="descrLine" select="."/>						<xsl:value-of select="concat(  ,°,$descrLine)"/>

In my sample above, the two entities are a non-breaking space and the degree symbol. This forum is converting them so you can't see them above. I'm using & #16o; and & #176; without the spaces.However, when I run my stylesheet, I get the following error:

SystemId Unknown; Line #69; Column #66; XSLT Error (javax.xml.transform.TransformerConfigurationException): javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: A location path was expected, but the following token was encountered:

The error message never says what the unexpected token is.Can anyone tell me what I'm doing wrong in my code? And descrLine does indeed have a value.Thanks,Steve

Link to comment
Share on other sites

Why the variable I must ask? Can't you just:

<xsl:value-of select="concat(  ,°,.)"/>

I think what might be causing the error is that those two symbols are not part of XPath's syntax. You need to enclose them in quotes to indicate you want a string to be outputted like this:

<xsl:value-of select="concat('& #16o','& #176',.)"/>

without the spaces of course.

Link to comment
Share on other sites

Blagodarya boen_robot. I made your changes including eliminating the variable. I appreciate your help very much.I need to be able to learn from this. Is the rule that if you have something that is not part of X-Path syntax, you need to enclose the "thing" in quotes?

Link to comment
Share on other sites

I can't help asking... are you bulgarian, or you just know the word? (щото вече съм виждал няколко тука и от двата вида и всички така не казват, докато не ме видят и кажат едно "благодаря" :) ).Yes. It is a rule. Wherever XPah expression is expected, you must enclose "strings" in quotes or as it more often happens - ampersants. Numbers I think don't need to be written in quotes, but I'm not sure. Never really used one in a value-of. I feel more comforable placing them next to it, rather then in it.

Link to comment
Share on other sites

Hi boen_robot,Thanks for the information.No, I'm not Bulgarian, but your member information indicates you are. I googled "thank you in Bulgarian" and that's how I found the word.What is the translation of the quote you included? --(щото вече съм виждал няколко тука и от двата вида и всички така не казват, докато не ме видят и кажат едно "благодаря" ).

Link to comment
Share on other sites

(щото вече съм виждал няколко тука и от двата вида и всички така не казват, докато не ме видят и кажат едно "благодаря" ).
It's "Because I've already seen a few here of both kinds and all of them don't say, until they see me and say a "thanks"". When I look at it now, it doesn't make much sense (in both languages :) ). What I meant was more of "Because I've seen both kinds, neither saying which one of the two are they, until I ask".
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...