473,554 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT: concat and quotes

Hello,

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

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

which results in

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

<div onMouseOver=fun c(' ')>
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 8329


Gerald Aichholzer wrote:

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

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

which results in

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

<div onMouseOver=fun c(' ')>
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= "onMouseOve r concat('func(', xyz,')')">

which results in

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

<div onMouseOver=fun c(' ')>
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;',$wor ld,'&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;',$wor ld,'&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
4006
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 HTML for documentation purposes. In particular I want XSLT to transform to HTML so that my XML documents can be "live", doing the transform in the...
3
7349
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
3233
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 name="Banner_error_2"> errormessage 2 for banner </xsl:variable>
3
2691
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 accessing the root element ID, here is a typical call: <xsl:variable name="fullPath"...
0
1161
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" item="282-333" qty="10" PO1="PO242" PO2="PO343" PO3="" PO4=""
2
3775
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, portTypes, and messages to use. But I'm stumped on how to get the xs:simpleType and xs:complexType elements filtered properly. I am not trying to...
1
13362
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> <Name>Vanilla</Name> <StartDate>20070704</StartDate> <EndDate>20071231</EndDate> </Flavor>
1
3445
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 when I output the file to a text file, all the data is wrapping and at the end of each block I am getting the text part of the header included but not...
1
5674
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" project="neptune"/> <file name="potrzebie.dbf" size="1102" project="jupiter"/>
0
7615
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8055
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7581
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7897
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5446
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3589
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
858
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.