473,749 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The normalize-space

Hi all

I'm trying to get a value from an xml node 'Publisher' use the value as
a name of an .css class. This works fine until I get a value from the
Publisher node with white space in it.
I've been trying to use normalize-space function on this but I can't
make this work

here is what I'm trying to do

<xsl:attribut e name="class">co lor<xsl:value-of
select="normali ze-space(Publisher )"/></xsl:attribute>

Can anyone help me, I've spent to much time on this already..
Thanks
K.

Dec 12 '06 #1
4 2732
normalize-space doesn't remove spaces, just trims off the ends and compacts
multiple whitespace to a single character.
Perhaps you can use translate(' ', '_') to change all spaces to an
underscore, maybe after normalize-space?

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

<ko*********@gm ail.comwrote in message
news:11******** **************@ j44g2000cwa.goo glegroups.com.. .
Hi all

I'm trying to get a value from an xml node 'Publisher' use the value as
a name of an .css class. This works fine until I get a value from the
Publisher node with white space in it.
I've been trying to use normalize-space function on this but I can't
make this work

here is what I'm trying to do

<xsl:attribut e name="class">co lor<xsl:value-of
select="normali ze-space(Publisher )"/></xsl:attribute>

Can anyone help me, I've spent to much time on this already..
Thanks
K.

Dec 12 '06 #2
ko*********@gma il.com wrote:
I'm trying to get a value from an xml node 'Publisher' use the value as
a name of an .css class. This works fine until I get a value from the
Publisher node with white space in it.
I've been trying to use normalize-space function on this but I can't
make this work

here is what I'm trying to do

<xsl:attribut e name="class">co lor<xsl:value-of
select="normali ze-space(Publisher )"/></xsl:attribute>
CSS class names can't contain white space, if you end up with e.g.
<div class="class name">
then the div elements belongs to two classes, one with name "class", the
second with name "name".

If you want to strip spaces from Publisher then use e.g.

<xsl:attribut e name="class">co lor<xsl:value-of
select="transla te(Publisher, ' ', '')"/></xsl:attribute>

If you want to use '-' instead of space then you could do e.g.

<xsl:attribut e name="class">co lor<xsl:value-of
select="transla te(normalize-space(Publisher ), ' ', '-')"/></xsl:attribute>
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Dec 12 '06 #3

ML wrote:
Could you give an example of the value in Publisher?
ML

---
http://milambda.blogspot.com/
Hi
The value is 'Pan vision' and I have to remove the whitespace or
replace it with _ so it will be 'PanVision' or 'Pan_Vision'.

Dec 12 '06 #4
Thanks Martin - this works like a charm :o)

Martin Honnen wrote:
ko*********@gma il.com wrote:
I'm trying to get a value from an xml node 'Publisher' use the value as
a name of an .css class. This works fine until I get a value from the
Publisher node with white space in it.
I've been trying to use normalize-space function on this but I can't
make this work

here is what I'm trying to do

<xsl:attribut e name="class">co lor<xsl:value-of
select="normali ze-space(Publisher )"/></xsl:attribute>

CSS class names can't contain white space, if you end up with e.g.
<div class="class name">
then the div elements belongs to two classes, one with name "class", the
second with name "name".

If you want to strip spaces from Publisher then use e.g.

<xsl:attribut e name="class">co lor<xsl:value-of
select="transla te(Publisher, ' ', '')"/></xsl:attribute>

If you want to use '-' instead of space then you could do e.g.

<xsl:attribut e name="class">co lor<xsl:value-of
select="transla te(normalize-space(Publisher ), ' ', '-')"/></xsl:attribute>
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Dec 12 '06 #5

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

Similar topics

3
4147
by: Christos TZOTZIOY Georgiou | last post by:
I found at least one case where decombining and recombining a unicode character does not result in the same character (see at end). I have no extensive knowledge about Unicode, yet I believe that this must be a problem of the Unicode 3.2 specification and not Python's. However, I haven't found out how the decomp_data (in unicodedata_db.h) is built, and neither did I find much more info about the specifics of Unicode 3.2. I thought about...
1
6027
by: Daniel Lim | last post by:
When using XmlSerializer, I notice that it does not normalize the single quote and double quote characters, i.e. does not change ' to &apos; and " to &quot. However, it does normalize other characters, like changing ampersand to &amp; Here is my code: ---- start of code -------- MyClass *myClass = MyClass() ; XmlSerializer *xs = new XmlSerializer( __typeof( MyClass ) ) ;
4
1928
by: Nathan Benefield | last post by:
I currently have a spreadsheet tracking votes on legislation in a matrix type format. It is something like this Name Act1 Veto1 Act1A Jones yes No Yes Johnson Yes Yes Ex. Only with many more members and bills. I want to normalize this so that i can create reports by both Bill and by member - linking it to tables
1
7603
by: jandhondt | last post by:
IN Visual Studio 2005 with VB.NET when I open a solution I often get this warning: The line endings in the following file are not consistent. Do you want to normalize the line endings? The warning occurs on an inherited form. My solution is under Source control with Visual Sourcesafe. No matter if I answer Yes or no, the next time it will still ask this. Does anyone know how to avoid this?
13
2201
by: WardC | last post by:
I'm a FileMaker user trying to help a client with an Access data entry problem: When text is copied from another application and pasted into an Access form, the pasted text sometimes includes unwanted characters (e.g., leading or trailing whitespace, embedded carriage returns, punctuation). We'd like to automatically normalize the pasted text. I know how I'd do this in FileMaker - perform an Auto-Enter calculation that replaces the newly...
5
10355
by: =?iso-8859-1?B?TWF0dGlhcyBCcuRuZHN0cvZt?= | last post by:
Hello! I'm trying to find what package I should use if I want to: 1. Create 3d vectors. 2. Normalize those vectors. 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in radians. 4. Perform matrix multiplication.
8
3003
by: bbcrock | last post by:
I have three tables with a relationship I've never worked with before. Can anyone suggest/comment on the best way to create a third normal form relationship between these tables? The tables basically are: TRAIN (TRAIN_ID and 15 columns about train specs, etc) TRUCK (TRUCK_ID and 12 columns about truck specs, etc) TRANSPORTATION_ITEM This table has, among others, two columns, TRUCK_ID and TRAIN_ID. If
5
1795
dmjpro
by: dmjpro | last post by:
Please explain me the job of Node.normalize(). I read out the docs but i don't understand. Please help me to understand. Kind regards, Dmjpro.
9
4284
by: Peter Bengtsson | last post by:
In UTF8, \u0141 is a capital L with a little dash through it as can be seen in this image: http://static.peterbe.com/lukasz.png I tried this: '' I was hoping it would convert it it 'L' because that's what it visually looks like. And I've seen it becoming a normal ascii L before in other programs such as Thunderbird.
1
5489
by: asharda | last post by:
Hi, I have to write a program which will calculate the PEAK and Normalize the audio files. I already have a class which returns an array of in for a given wave file. Does anyone know how I can get the PEAK value in decibels instead of integer or double?
0
8996
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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
9388
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
9333
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
9254
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...
0
8256
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
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...
1
3319
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

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.