473,769 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

preventing an entity-reference to be resolved (output method XML)

Hi everyone,

I have this stylesheet:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<node>&apos;</node>
</xsl:template>
</xsl:stylesheet>

My goal is to get this output:
<?xml version="1.0" encoding="UTF-8"?><node>&apos ;</node>
I've tried '&amp;apos;' , '&apos;'
I tried to do it with custom ENTITY's in the DOCTYPE.
I tried with CDATA sections.
But non of it works.

I know it works if the output method is 'text', but it has to work in
'xml' too.
Any help or comments greatly appreciated...

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #1
3 2231


Joris Gillis wrote:

I have this stylesheet:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<node>&apos;</node>
</xsl:template>
</xsl:stylesheet>

My goal is to get this output:
<?xml version="1.0" encoding="UTF-8"?><node>&apos ;</node>
I've tried '&amp;apos;' , '&apos;'
I tried to do it with custom ENTITY's in the DOCTYPE.
I tried with CDATA sections.
But non of it works.

I know it works if the output method is 'text', but it has to work in
'xml' too.


I think within the XSLT 1.0 standard there is nothing for you to mandate
whether such a character is serialized in UTF-8 as an enity reference or
literally. However some processors have extensions to achieve that, for
instance Saxon:
http://saxon.sourceforge.net/saxon6....xon:entity-ref
where the documentation says it is meant for HTML entity references but
maybe you can use it for other output methods as well.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
On Sun, 10 Oct 2004 16:21:43 GMT, "Joris Gillis" <ro**@pandora.b e>
wrote:
I know it works if the output method is 'text', but it has to work in
'xml' too.


As far as I know, there is no way to do this in XSLT. It is an _XML_
problem - in XML the entity reference and the character itself are
seen as equivalent and so there is never any need (sic) to control
the choice explicitly.

You need to modify the behaviour of the XML serialiser that is used to
generate the output document. I've done this, but I had to change the
serialiser code to do so. Maybe some other tools will already allow
this to be controlled ? I was just working with what I had.

As it's &apos; you're after (and if this is all you're after), an
output mode of "HTML" might work for you. &apos; is defined in XML,
but not in the HTML DTDs.

--
Smert' spamionam
Jul 20 '05 #3
Thank you, Martin and Andy, for your replies.

It seems to be there is indeed (not yet) a standard-compliant way to solve
this.

Meanwhile, I figured out that
<xsl:text disable-output-escaping="yes"> &amp;apos;</xsl:text>
returns the returns the result I want.

But the XSLT1.1 specification clearly states that it is illegal to use
'disable-output-escaping' with attribute nodes, which is actually what I'm
trying to achieve.

The actual problem I had:
OpenOffice.org (1.1.3) crashes when it finds a single quote (') in font
declaration attributes in the content.xml part of a file. It does not
accept anything else than '&apos;'. So generating content.xml with XSLT1.1
directly now seems impossible.
About the trick to set the ouptut method to 'HTML' , it doesn't work with
me. (I'm using AltovaXslt)
regards,

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #4

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

Similar topics

5
2157
by: Ronald Fischer | last post by:
Could someone explain to me what is the difference between <!ENTITY % Foo 'Bar' > and <!ENTITY Foo 'Bar' > From my understanding, the "macro" Foo has to be referenced in the first case by %Foo; and in the second case by &Foo; , but
3
1753
by: Vineeth | last post by:
Hi, I am developing an application using the SAX interface provided by "xerces-j 2.6.0". My application does not need a DTD for execution as it is not supposed to perform any validation. I have to provide customized entity processing for which I have implemented the startEntity function of the LexicalHandler interface. The problem that I am facing is with respect to any entity other than the 5 builtin ones. If any entity for example...
1
6595
by: Razvan | last post by:
Hi What is the difference between an internal and an external entity ? The first one is defined in the internal subset (not in a separate DTD file, but in the XML file itself - in DOCTYPE) while the second one is defined in the external subset (in a separate DTD file) ? Or an
18
27719
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , NOT NULL , CONSTRAINT PRIMARY KEY CLUSTERED (
2
1563
by: Emily Jones | last post by:
That subject line will have Joe Celko apoplectic!! Let's say I have this thing. Oh, I don't know, a car. No, a vehicle. Can we agree that is an entity type? Some attributes might be VIN, Fuel, Color. Some entity instances might be: wvv2939-32-2993-2-90, Gasoline, Blue wvv3942-3249--2830-2, Diesel, Red I wanna make it easy to get the colors in. Keep a list of 'em somewhere. So
11
2013
by: Jean-François Michaud | last post by:
Hello all, I'm having a little problem, The UTF-8 parser we are using converts the newline entity ( ) within an attribute that we are using to paliate CSS limitations. After the parser has gone through the document, the entity is converted to \n, which then effectively tosses out the window the behavior we are getting by keepinig the entity AS IS within the document.
6
1690
by: Jeffrey Goldberg | last post by:
I suspect that this is a common problem (and so with a known solution/work-around), but my attempts to find it have failed. I have a float (a table of content box) on the left of a page. The headers within the main material either have distinct background colors or borders. These borders don't seem to recognize that they are in material that is wrapped around the float. I can force specific headers to have sufficiently large left...
14
1777
by: Dave Rahardja | last post by:
Hi all, Is it possible to prevent _at compile or link time_ the mulitple instantiation of a templated function? In other words, if there exists a function template <typename Tvoid fn(); I want to prevent the user from doing this: int main()
3
1982
by: chris.kennedy | last post by:
I am really struggling to create an entity which maps to 2 "base" entities. I have a customer and invoice entity which are based in tables in a one to many relationship. I have tried: 1. Creating a Invoice Entity based on the Invoice and adding a mapping to both tables: I can't validate the model it says "Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with...
4
2549
by: Jeff | last post by:
hi asp.net 2.0 I have a table, (lets call the table "Car") which links to the aspnet_Users table. (UserId) I'm creating an entity class of the car table, containing all the fields in the car table, except that I'm unsure what to do with the field linking to aspnet_users. I mean I can just use the UserId column, but in my website I'm
0
9589
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
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9994
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
9863
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
5298
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.