473,782 Members | 2,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing a space

I have a template that searches for and replaces found instances of
strings in other strings and replaces them with yet another string.
These strings are passed to the template as parameters, not
surprisingly. It so happens at the moment that I need to replace
instances of spaces with a plus sign. Unfortunately, I don't know how
to pass a space effectively, the template just doesn't get it.

Any thoughts re how to fix this would be appreciated!

TIA,
David

Oct 8 '07 #1
6 2523
Hi David,

You are not saying how you pass the parameters... Are you passing them
from a call-template instruction?
In that case I do not see the difficulty with that, just enclose the
space in apostrophes if you put that in the select attribute.

<xsl:with-param name="p" select="' '"/>

Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Oct 8 '07 #2
Are you passing them from a call-template instruction?

Yes, that's how they're being passed but when I use this syntax,
<xsl:with-param name="p" select="' '"/>, I get an 'Empty expression'
error from the processor (XALAN). Isn't the 'select' attribute
reserved for nodes? I've been using "<xsl:with-param name="p"</
xsl:with-param>" to no avail.

David

Oct 8 '07 #3

David Schwartz <da******@gmail .comwrote in
<11************ *********@22g20 00hsm.googlegro ups.com>:

[problems passing space as a parameter to a template]
>Are you passing them from a call-template instruction?

Yes, that's how they're being passed but when I use this
syntax, <xsl:with-param name="p" select="' '"/>, I get an
'Empty expression' error from the processor (XALAN). Isn't
the 'select' attribute reserved for nodes?
No.
I've been using
"<xsl:with-param name="p"</xsl:with-param>" to no avail.
Works just fine for me with xsltproc, Saxon-8B, xalan-c++:

pavel@debian:~/dev/xslt$ a param_space.xsl
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="named">
<xsl:with-param name="str" select="' '"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="named">
<xsl:param name="str"/>
<result>
<xsl:value-of select="$str"/>
</result>
</xsl:template>
</xsl:stylesheet>
pavel@debian:~/dev/xslt$ xsltproc param_space.xsl
param_space.xsl
<?xml version="1.0"?>
<result</result>
pavel@debian:~/dev/xslt$ saxon -t param_space.xsl
param_space.xsl
Saxon 8.8J from Saxonica
Java version 1.5.0_11
Warning: at xsl:stylesheet on line 2 of
file:/var/www/dev/xslt/param_space.xsl :
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Stylesheet compilation time: 892 milliseconds
Processing file:/var/www/dev/xslt/param_space.xsl
Building tree for file:/var/www/dev/xslt/param_space.xsl
using class net.sf.saxon.ti nytree.TinyBuil der
Tree built in 4 milliseconds
Tree size: 24 nodes, 0 characters, 9 attributes
<?xml version="1.0" encoding="UTF-8"?>
<result</result>Executio n time: 138 milliseconds
Memory used: 576184
NamePool contents: 14 entries in 14 chains. 7 prefixes, 8
URIs
pavel@debian:~/dev/xslt$ xalan -in param_space.xsl -xsl
param_space.xsl
<?xml version="1.0" encoding="UTF-8"?>
<result</result>
pavel@debian:~/dev/xslt$

Perhaps the problem lies elsewhere. Try reproducing it in a
minimum possible transformation.

--
It is rare to find learned men who are clean, do not stink,
and have a sense of humour. -- Liselotte in a letter to
Sophie, 30 Jul 1705
Oct 8 '07 #4
When I use <xsl:with-param name="p" select="'e'"/(for testing
purposes, NOTE: NOT a space), I get the following result:

JVMDG217: Dump Handler is Processing Signal 11 - Please Wait.
JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written to Z:\aDL\Design Patterns\GSA content
\javacore.20071 008.081548.7900 .txt
JVMDG215: Dump Handler has Processed Exception Signal 11.

When I use <xsl:with-param name="p">e</xsl:with-param>, it works like
a charm.

FYI, I'm using XALAN v.2.7.0.

David

Oct 8 '07 #5
In article <11************ *********@22g20 00hsm.googlegro ups.com>,
David Schwartz <da******@gmail .comwrote:
>Yes, that's how they're being passed but when I use this syntax,
<xsl:with-param name="p" select="' '"/>, I get an 'Empty expression'
error from the processor (XALAN).
As others have said, this should work.
>I've been using "<xsl:with-param name="p"</xsl:with-param>" to no avail.
This *won't* work, because of whitespace stripping. Add an
xml:space="pres erve" attribute to the xsl:with-param element.

-- Richard

--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Oct 8 '07 #6
Richard Tobin wrote:
>>I've been using "<xsl:with-param name="p"</xsl:with-param>" to no avail.

This *won't* work, because of whitespace stripping. Add an
xml:space="pres erve" attribute to the xsl:with-param element.
Or use
<xsl:with-param name="p"><xsl:t ext</xsl:text></xsl:with-param>

Good catch; I wasn't reading that closely.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Oct 8 '07 #7

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

Similar topics

9
2985
by: BKDotCom | last post by:
Many built-in functions allow an optional variable to be passed for error messages. How do I implement this in my own function? function test($param1, $param2, &$errormsg) { // complains if 3rd param is not sent } function test($param1, $param2, &$errormsg='') { // complains about something }
12
2896
by: harry | last post by:
I have an object that's passed in to a function as a parameter i.e public boolean getProjectTitle(ProjectHeader_DTO obj) {...} If I then call a method on this object inside the function i.e obj.setTitle("test") then using obj.getTitle() from outside the function it displays the property set correctly! But doing something like this inside the function doesn't - ProjectHeader_DTO x = new ProjectHeader_DTO();
6
1902
by: Bryan Martin | last post by:
I have a object that is created in a seperate domain which needs to be passed back to the parent class. Because this object is created in a seperate domain if I try to pass the object back to the parent class (different domain) I receive an error about "File Not Found". I know the object is created successfully and the objects method can be called after loading the object however upon passing it back to the calling class it exploades. I...
5
9019
by: lugal | last post by:
This might be more appropriate here. I'm new to C++, coming from a background in another languages that allowed a similar solution to work (Python). I wrote the following code in C++ based on the Python code found here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 //beginning #include <vector>
6
12660
by: DeepaK K C | last post by:
Could anybody tell me how to pass array to a function by value? -Deepak
61
3161
by: academic | last post by:
When I declare a reference variable I initialize it to Nothing. Now I'm wondering if that best for String variables - is "" better? With Nothing I assume no memory is set aside nor GC'ed But with "" it is - correct? The system seems to handle a null the same as "".
5
3086
by: nass | last post by:
this is a thought experiment. i do not have the time to implement it and test it to see if it works so i am relying on your good will:) thank you in advance im on a linux machine (slackware 10.2) on an i686 intell processor. its my first attempt to convert a fileIO procedure, to a pthread so it won't stall the execution of the code. im going through an online tutorial
16
3394
by: Theo R. | last post by:
Hi all, Does the C99 Standard explicitly mention the need for a stack for passing arguments or Is this platform specific? As an example, the ARM9 processor recommends Core Registers R0-R3 be used when passing less than four parameters. However some compilers for ARM9 do not follow this recommendation and place all parameters on the stack. Therefore, the question arises if the compilers were following the C Standard instead.
7
2160
by: pereges | last post by:
which one do you think is better ? I need to make my program efficient and in some places I have passed the copy of a variable which makes life some what easy while writing huge expressions but they do requrie much more memory than a simple pointer.
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10143
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10076
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9939
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7486
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5375
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.