472,374 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

XSLT: concat and quotes

Hello,

I need to specify the following attribute in an xhtml-file
containing TAL templates:

<div tal:attributes="onMouseOver concat('func(',xyz,')')">

which results in

<div onMouseOver=func( )>
^
value of xyz here
My problem is, that I need to put quotes around the content
of xyz:

<div onMouseOver=func(' ')>
How can I achieve this? The double quotes are already in
use by tal:attributes, the single quotes are used by the
concat-function.

thanx in advance,
Gerald
Jul 20 '05 #1
4 8236


Gerald Aichholzer wrote:

I need to specify the following attribute in an xhtml-file
containing TAL templates:

<div tal:attributes="onMouseOver concat('func(',xyz,')')">

which results in

<div onMouseOver=func( )>
^
value of xyz here
My problem is, that I need to put quotes around the content
of xyz:

<div onMouseOver=func(' ')>
How can I achieve this? The double quotes are already in
use by tal:attributes, the single quotes are used by the
concat-function.


I don't know what TAL is but if you are asking about the XPath function
concat then you need to split up the string into parts containing single
quotes and into parts contaning double quotes if needed e.g.
<xsl:value-of select="concat('func(', &quot;'&quot;, 'xyz',
&quot;'&quot;, ')'" />

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Martin Honnen wrote:

Gerald Aichholzer wrote:
I need to specify the following attribute in an xhtml-file
containing TAL templates:

<div tal:attributes="onMouseOver concat('func(',xyz,')')">

which results in

<div onMouseOver=func( )>
^
value of xyz here
My problem is, that I need to put quotes around the content
of xyz:

<div onMouseOver=func(' ')>
How can I achieve this? The double quotes are already in
use by tal:attributes, the single quotes are used by the
concat-function.

I don't know what TAL is but if you are asking about the XPath function
concat then you need to split up the string into parts containing single
quotes and into parts contaning double quotes if needed e.g.
<xsl:value-of select="concat('func(', &quot;'&quot;, 'xyz',
&quot;'&quot;, ')'" />


I'm speaking about the XPath function concat. I think I should
have specified my problem a little bit better. In my application
the tal:attributes works as follows:

<div tal:attributes="attrname XPath-expression">

where

attrname is the name of an attribute which is created
XPath-expression specifies an XPath-expression which
value is assigned to the attribute.

e.g.

<div tal:attributes="sample concat('hello',' ','world')">

will be expanded to

<div sample="hello world">
My problem is, that I need single _and_ double quotes in
the strings used by concat, but the double quotes are
already used for tal:attributes="..."

I don't think that

<div tal:attributes=
"sample concat('hello ','"',$world,'"')">

will work, because the second " is considered to be the
end of tal:attributes.

If $world="gerald" then the above should result to

<div sample="hello 'gerald'">

How can I achieve this?

Thanx in advance,
Gerald
Jul 20 '05 #3


Gerald Aichholzer wrote:

My problem is, that I need single _and_ double quotes in
the strings used by concat, but the double quotes are
already used for tal:attributes="..."

I don't think that

<div tal:attributes=
"sample concat('hello ','"',$world,'"')">

will work, because the second " is considered to be the
end of tal:attributes.


You need to escape the double quotes then

<div tal:attributes=
"sample concat('hello ','&quot;',$world,'&quot;')">

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4

Martin Honnen wrote:

Gerald Aichholzer wrote:
My problem is, that I need single _and_ double quotes in
the strings used by concat, but the double quotes are
already used for tal:attributes="..."

I don't think that

<div tal:attributes=
"sample concat('hello ','"',$world,'"')">

will work, because the second " is considered to be the
end of tal:attributes.

You need to escape the double quotes then

<div tal:attributes=
"sample concat('hello ','&quot;',$world,'&quot;')">


Thank you very much :)

Gerald
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Patrick Reilly | last post by:
I am trying to implement a better method than I already have to document database schemas with XML, and use XSLT to both generate database DDL statements (CREATE TABLE, etc) and to transform to...
3
by: Son KwonNam | last post by:
The title is quite ambiguos. Any way let me explain. In java, the following is possible. ---- String str = ""; for (int i=0; i < 10; i++) { str = str + i; } ----
4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
3
by: shaun roe | last post by:
I have a document about 4 levels deep and in my XSLT I want to generate a unique string ID for each basic element based on its path through the hierarchy. If I use recursion, I am continually...
0
by: david.paik | last post by:
Given the data: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="C:\junk\830new.xslt"?> <SC830> <SC830_3 bano="S67777" cuno="002620" year="2007" week="38"...
2
by: Scott Sauyet | last post by:
I'm trying to select a subset of a WSDL document using XSLT and a simple text document describing the high-level elements to include. I have it working fine for selecting the services, bindings,...
1
by: n.phelge | last post by:
I'm using XSLT and .NET Framework 1.1 to try to transform XML to group by multiple values, and I'm not succeeding. I have source XML that looks like the following: <Data> <Flavor>...
1
by: CAM123 | last post by:
I have added: <br><xsl:value-of select="Line" /></br> to my XSLT stylesheet to get a line per repeating block. When I view the output as XML it looks perfect - one line per block. However...
1
by: Sandeep Singh | last post by:
Hi, How to do group by in XSLT ? I tried on the following codes: <files> <file name="swablr.eps" size="4313" project="mars"/> <file name="batboy.wks" size="424" ...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.