"'copyof.xsl" - <?xml version="1.0" encoding="utf-8"?>
-
-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
<xsl:template match="/">
-
<html>
-
<head>
-
<SCRIPT LANGUAGE="JavaScript">
-
<xsl:comment>
-
<![CDATA[
-
function window.onload()
-
{
-
alert(xmlData.xml);
-
}
-
]]>
-
</xsl:comment>
-
</SCRIPT>
-
</head>
-
<xml id="xmlData">
-
<xsl:copy-of select="*"/>
-
</xml>
-
</html>
-
</xsl:template>
-
</xsl:stylesheet>
-
"good.xml" - <?xml version="1.0" encoding="utf-8"?>
-
<?xml-stylesheet type='text/xsl' href='copyof.xsl'?>
-
<Apple name="Farm">
-
<Tag name="West"/>
-
</Apple>
"bad.xml" - <?xml version="1.0" encoding="utf-8"?>
-
<?xml-stylesheet type='text/xsl' href='copyof.xsl'?>
-
<Apple name="Farm">
-
<Tag name="West&lt;"/>
-
</Apple>
Notice that the only difference of 2 xml files is
<Tag name="West<"/>
bad.xml has a special characters "<", good.xml can get expected result in IE, but bad.xml couldn't...
Anyone can help me to figure out what's wrong and how to resolve the bad.xml file?
16 2158
It's probably the entity < which is <
Does it work if you double-escape it?
<Tag name="West&lt;"/>
It's probably the entity < which is <
Does it work if you double-escape it?
<Tag name="West&lt;"/>
Yes, it works, but what i wanted here is a < not <
Don't think it's doable then. The < would break the well-formedness of the xml.
Nobody ever encountered this problem?
People have encountered this problem, but it is part of IE's expected behaviour. It doesn't display malformed code correctly.
What you're doing is not allowed.
If you want to force it to work, then you would need to write your own web browser.
but why can't only "copy-of" work?
the following xsl can work: - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
<xsl:template match="/">
-
<html>
-
<body>
-
<xsl:apply-templates select="Apple/Tag"/>
-
</body>
-
</html>
-
</xsl:template>
-
<xsl:template match="Tag">
-
<xsl:value-of select="@name"/>
-
</xsl:template>
-
</xsl:stylesheet>
-
Looking at it from another point of view,
Your problem is that you're using xmlData.xml.
When you load invalid xml, the call to the xml property returns the empty string because it is invalid xml.
What you want is a text string instead of xml.
jkmyoung, thanks very much, but I have some disagreement.
1. I don't think it will work if I try to get the text string of xmlData.
2. It is not a invalid xml, since it will display well using the above style.
1. No, because it is invalid XML and thus doesn't load properly. I suggested using a string object instead of an xml object.
2. What do you mean above style? Do you mean the proper xml works?
1. No, because it is invalid XML and thus doesn't load properly. I suggested using a string object instead of an xml object.
2. What do you mean above style? Do you mean the proper xml works?
I mean bad.xsl works well using this style sheet: - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
<xsl:template match="/">
-
<html>
-
<body>
-
<xsl:apply-templates select="Apple/Tag"/>
-
</body>
-
</html>
-
</xsl:template>
-
<xsl:template match="Tag">
-
<xsl:value-of select="@name"/>
-
</xsl:template>
-
</xsl:stylesheet>
So that means it is not an invalid xml file, only "copy-of" can't work...
Try this, I am using decimal entity for less than in xml file and the tag "<xsl:output method="xml" indent="yes" version="1.0" encoding="ISO-8859-1"/>" in xsl, it shows <, but the proper symbol not viewing - <?xml version="1.0" encoding="utf-8"?>
-
<?xml-stylesheet type='text/xsl' href='copyof.xsl'?>
-
-
<Apple name="Farm">
-
<Tag name="West<"/>
-
</Apple>
- <?xml version="1.0" encoding="utf-8"?>
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
<xsl:output method="xml" indent="yes" version="1.0" encoding="ISO-8859-1"/>
-
<xsl:template match="/">
-
<html>
-
<head>
-
<SCRIPT LANGUAGE="JavaScript">
-
<xsl:comment>
-
<![CDATA[
-
function window.onload()
-
{
-
alert(xmlData.xml);
-
}
-
]]>
-
</xsl:comment>
-
</SCRIPT>
-
</head>
-
<xml id="xmlData">
-
<xsl:copy-of select="*"/>
-
</xml>
-
</html>
-
</xsl:template>
-
</xsl:stylesheet>
That is "West(ampersand ash 60 semicolon)"
Without opening and closing braces. Is it working in your system?
what browser are you using? value-of does not work for me.
Try this, I am using decimal entity for less than in xml file and the tag "<xsl:output method="xml" indent="yes" version="1.0" encoding="ISO-8859-1"/>" in xsl, it shows <, but the proper symbol not viewing
yeah, the line - <xsl:output method="xml" indent="yes" version="1.0" encoding="ISO-8859-1"/>
really works, although I just remove the "encoding" attribute :-)
amazing, what does it do?
yeah, the line - <xsl:output method="xml" indent="yes" version="1.0" encoding="ISO-8859-1"/>
really works, although I just remove the "encoding" attribute :-)
amazing, what does it do?
Sorry, I also dont know exactly, but long back I also faced the viewing problem, while on that time, I had been searched and used it.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Thomas Vackier |
last post by:
Hi all,
I'm trying to delete a certain tag in an XML document using XSL, but I
can't figure out how.
Here's how my XML looks like:
<root>
<element>
<name>This is text</name>
|
by: insane79 |
last post by:
Hi,
i have one problem with an xsl trasformation (I'm using Xalan)
The source XML document is the following:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<ROOT...
|
by: Tjerk Wolterink |
last post by:
Hello, i've an xml doc like this:
<doc>
<item>a</item>
<item>b</item>
<item>c</item>
<item>d</item>
<item>e</item>
<item>f</item>
<item>g</item>
|
by: Tjerk Wolterink |
last post by:
I've a problem in an xsl transformation.
My xml input:
--- input.xml ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xc:content >
<xc:xcontent...
|
by: Chris |
last post by:
I have the following XML:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<ORDERS>
<ORDER>
<ORDER_ID>123</ORDER_ID>
<X>a</X>
<X>e</X>
<X>f</X>
</ORDER>
|
by: Beniamin Tecar |
last post by:
Hi,
I have an xml :
<DataRecords>
<Point Alias='A' Value='1' Status='0' />
<Point Alias='B' Value='2' Status='0' />
</DataRecords>
I have needed by an XSL to insert a node between...
|
by: bhushan.kharabe |
last post by:
Hi,
I am stuck in problem involving transformation where the tree structure
of the target is different than the tree structure of the source.
My input xml looks like
<?xml version="1.0"...
|
by: @do |
last post by:
Hi!
My XML File is something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<item_list>
<item_list_elements>
<code>01600</code>
<name>John</name>
<text>some text ABC</text>
|
by: Simon Brooke |
last post by:
This is supposed to be a very simple XSL stylesheet to strip styling
information out of HTML documents - it could not be more basic. And yet,
it doesn't work. I'm obviously getting something very...
|
by: mtugnoli |
last post by:
I've found a sample on http://msdn2.microsoft.com/en-us/library/ms766561.aspx
to filter a .XML
ex.
<?xml version="1.0"?>
<COLLECTION dateCreated="01-04-2000">
<BOOK>
<TITLE>Splish...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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...
|
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,...
| |