473,412 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Problems when trying to keep , after XSL transformation

Hi,

I am performing an XSLT on a XML feed. The XSLT produces me with PHP
code that I eval then insert into my DB. However, the way that the
system Im assigned to is setup, I need to convert all instances of
comma ',' to entity ',' .. so this requires that the output of the
XSLT needs to produce ',' but instead it converts it to a comma
which the current system doesnt like when handling it.

Below shows a snippet of what I have. What is happening here is that a
text output of PHP code is produced that I will then go on to execute
using PHP eval():

<xsl:template ...>

function ConvertString($str) {
$str = str_replace(',', ',', $str); // , gets converted to a
comma during the XSLT
return $str;
}

</xsl:template>

Ive tried a number of things such as :

$str = str_replace(',', '&amp;#44;', $str);

$str = str_replace(',', '<xsl:text>,</xsl:text>', $str);

$str = str_replace(',', '<![CDATA[,]]>', $str);

<xsl:output method="text" encoding="iso-8859-1" indent="no"/>
$str = str_replace(',', ',', $str);

... all with different outputs but none doing what I need.

Can anyone tell me how to output entities as a result of the XSLT?
Thanks

Burnsy
Jul 11 '08 #1
2 1727
bizt wrote:
Can anyone tell me how to output entities as a result of the XSLT?
You will have to check the documentation of your XSLT processor whether
you can plug in a custom serializer and then you will have to implement
that serializer.

Or you could try an XSLT 2.0 processor and character maps:
http://www.w3.org/TR/xslt20/#character-maps

There are currently three XSLT 2.0 processors, Saxon, Gestalt, and
AltovaXML tools.
Saxon comes as a Java and as a .NET version: http://saxon.sourceforge.net/.
Gestalt is available at http://gestalt.sourceforge.net/.
Altova at http://www.altova.com/altovaxml.html, it is COM solution with
Java and .NET bindings.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 11 '08 #2
As far as the XML standard is concerned, there is absolutely no
difference between , and the comma character. I would suggest fixing
whatever tool you're using that cares about this difference... or
finding another solution for marking up this distinction, such as
<comma>... or just run a postprocessor after the XSL transformation that
does a character-replace of all commas with ,.
Jul 11 '08 #3

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

Similar topics

0
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron...
1
by: Doug Farrell | last post by:
Hi all, I'm trying to use the 4Suite xml/xsl tools to transform some XML data into HTML. I'm using some examples from the O'Reilly book "Python and XML" and things are blowing up. Here is the...
0
by: Robert Brewer | last post by:
Hello, I realize I'm a bit over my head, here, but I'm trying to pull waypoint data from a Garmin eTrex Legend, and having mixed success. On a Win98 box last night, I was able to connect and...
0
by: Michael Fork | last post by:
Note: I pasted the code the attachments as plain text after the message (I wasn't able to post it with an attachment...) Attached are the XSL and XML files that I am having problems with. I am...
1
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a...
1
by: Eric | last post by:
I am trying to figure out a good way to implement a XSLT transformation. Basically my goal is that I want to be able to ouput the following XML in a document: <chart type="pie" width="100"...
1
by: Pablo | last post by:
Hello, I wrote an xslt to apply to a XML. The output that I expect is: <TEST> Test Output </TEST> But i get en empty XML...I know that is a problem of the namespace in XML but I don't...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
0
by: Amit00 | last post by:
Hi, I'm performing an xsl transformation in a page I built, and would like to use some custom controls in it (or asp controls, for that matter). I looked this issue up, and understood that it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...
0
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...
0
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...

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.