|
The problem is your commented out line was being taken as instructions to the transformation processor not as output. Try Essam's suggestion as it is the simplest. And drop a message back. My concern is it may stay as the encoded text in the output. But just because I have never done it that way so what. You may need to force this line to be text output. Look at the processing instruction:
<xsl:text>Most any data here.
There are limits to this also but it is what I have used most often. I also use the output instructions to not have any text output that is not explicit such as this line:
<xsl:output method="text" encoding="utf-8" media-type="model/vrml" indent="no" cdata-section-elements="Script">
I do this so as to not pickup extra linefeeds etc.
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
I think there's quite a bit of XML data your missing from your output, remember to substitute < and > in the right places.
Besides that, replacing it with < and > didn't work for the !DOCTYPE. It just outputted the actual text of <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Any other ideas?
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Yes I did not check the display message as is (no HTML).
I was just adding the xsl:text tag that essam mentions above. There are also option to not add all of the text (line feeds etc.) to the output.
My Sample lines were approximately:
<xsl:output method="text" encoding="utf-8" media-type="model/vrml" indent="no" cdata-section-elements="Script"/>
<!-- ****** X3D: convert the X3D tag to VRML 3.0 header ****** -->
<xsl:template match="X3D">
<xsl:text>#VRML V2.0 utf8 </xsl:text>
<xsl:text># [X3D] VRML V3.0 utf8 </xsl:text>
<xsl:apply-templates select="Scene"/>
</xsl:template>
This is the begining of my translation file for converting X3D models into VRML97. Lets see if I get it right this time.
There are a number of sites with info here.
One example is the w3schools site
http://www.w3schools.com/xsl/el_text.asp
and zvon
http://www.zvon.org/xxl/XSLTreference/W3C/xslt.html#element-text
both on the partners links on CP.
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
This works great! Thank you so much!
But now I've got another question... Should I do the same thing for my <?xml version="1.0" encoding="utf-8"?> that I want at the very top of the output document, or will this be done for me? From what I've seen using XSL Tester to view my XHTML output, this is done for me, but it gives me an encoding="UTF-16" , which I don't think is a valid encoding.
Can I somehow change the way this is generated automatically if it is, or is this simply a quirk in XSL Tester and I should do the same thing Idid with my !DOCTYPE, by putting it in that special <xsl:tex> element?
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
I assume that you are using one of the MSXML implementations. To set the encoding see the xsl:output transformation element (at the begining of the transformation), You should be able to set utf-8 with it. UTF-16 is a valid encoding. Most of my work right now is with the Apache line of implementations so there may be some variations. I have shown that DOM and SAX transformations do not always give the same results. I do have some test applications with the MSXML v3 and v4 so I can do some experiments if needed.
<xsl:output method="text" encoding="utf-8"/>
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
I am using the MSXSL that comes with IE6 or the .NET Runtime, whichever is newer (I have both installed).
So XSL will generate an <?xml...?> declaration automagically, which can be controlled by the <xsl:output> element?
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
I can say that the xml declaration is not allways output. With the output line shown earlier it should never be output. Just add it with the xsl:text line if needed. The output line will set if encoding is utf-8.
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
So, my XSL should like like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0">
<xsl:output encoding="utf-8" />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
</xsl:text>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<!-- Stuff here -->
</html>
</xsl:template>
</xsl:stylesheet>
And this will output:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<!-- The stuff that was where the comment was goes here -->
</html>
If you're not absolutely sure, could you write me quick program or give me the JScript code (not .NET) to just output the text? Whenever I do a view source in IE, it just gives me the original XML.
I would do that myself, but I'm stuck on this Windows 98 until I get a new hard drive
Thank you!
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
There are two ways to output the DOCTYPE.
One is using the OUTPUT method in XSL, like so:
>xsl:output method="html" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="DTD/xhtml1-transitional.dtd" indent="yes" /<
The other, is easier but probably not such a good idea. It uses the XSL:TEXT and CDATA section methods:
>xsl:text disable-output-escaping="yes"<>![CDATA[>!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"<]]<>/xsl:text<
This one also baffled me for awhile until I found the OUTPUt method, happy hunting.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
|
|
|
|
|
Paul,
Nice to see you back. I hope this is not temporary.
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
Thanks Michael, it is semi-temporary. I have not been off of CP voluntarily, but rather I have been at the mercy of my internet connection which deems CP an unforgivingly slow site.
However our new line should be in within the week and I shall be back next week.
I miss the place
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
|
|
|
|
|
The output works GREAT for the !DOCTYPE, and is much preferable to the method I got from above (enclosing it in a <xsl:text disable-output-escaping="yes"> section)
But... I'm still stuck on getting my <?xml...?> into the output, as I am really trying to output XHTML, not HTML as the above <xsl:output> you posted says (and all good XHTML has a <?xml...?> declaration, as it is XML).
Will this automagically appear, with the encoding specified in the <xsl:output> tag? Or do I have to put it in a <xsl:text disable-output-escaping="yes"> tag?
Again, I could figure this all out myself without bugging everyone if someone would just write a program that takes in.xml, and using transform.xsl outputs out.xsl. That's all I need! I have one that is supposed to do this called XSL Tester, but it's rather screwy (always outputting a <?xml version="1.0" encoding="UTF-16"?> at the top, no matter what I do with output or text tags.), and doesn't use the .NET version of MSXML so I'm never sure if that's really what's going to happen. Heck, I could send you the source code if you would compile it!
Thank you for your time and help,
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Actually, now I have a working solution, but I'm getting the idea it's bad practice, and wanted to know if it is.
I enclose EVERYTHING in a:
<xsl:text>
<!CDATA[[
<!-- There's a bunch of XHTML here,
including the xml processing instruction and the
DOCTYPE, but it's parsed as simply text. Is
this good practice? Because it's convenient! -->
]]>
</xsl:text>
section. It works, and it's very convienient. Whenever I want to output something using template rules, I simply end if with a ]]></xsl:text> , write the xsl element, then restart it with the <xsl:text><!CDATA[[ . But... this just seems kind of wrong... but it works... but it seems wrong... but... so, what do you think?
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Domenic [Geekn] wrote:
But... this just seems kind of wrong... but it works... but it seems wrong... but... so, what do you think?
It works, just like using pantyhose to fix a broken fan-belt in a car works. However as soon as you can you should get a new proper fan-belt, right?
I had a crushing deadline which forced me to use the xsl:text method to output the DOCTYPE.
However what happened was that when a third party tried to programatically query my XSL documents to gather some info for an integration project they failed to get the DOCTYPE. I eventually re-coded my XSL docs to use the output method.
So the answer is; Yes it works but don't do it if you can avoid it. Your XSL docs will be technically better and easier to maintain in the future if you use the proper output method.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
"Reports of my death have been greatly exaggerated."
|
|
|
|
|
Hi there, anybody using Microsoft Sharepoint Portal? If any one know how to customize the sharepoint enviroment or where to get more web part, please help me! Thanks all.
Tho
|
|
|
|
|
Go to the Microsoft site and search for Sharepoint. You'll find plenty of information there.
You can get a bunch of web parts here.
|
|
|
|
|
Thanks a lots, MarSCoZa! It is really helpful, do u know how to set the SMTP
setting to use the email notification feature in Sharepoint? How to made it automatically send email to approver after document have been published.
Thanks !
regards, Tho
|
|
|
|
|
I haven't worked very intensively with Sharepoint, but from the User's help it seems you have to do the following:
1) In Windows Explorer, expand your workspace (under My Network Places)
2) Right-click on the Documents folder and select Properties
3) Select the Approval tab, and fill in the details
|
|
|
|
|
Hi all,
I'm having problems displaying a '&' in an XML tag.
<senderaccname>dssdsd&sdsdsd
When I run this on a XSL Stylesheet, I get the following error:
Ein Semikolon wurde erwartet. Fehler beim Bearbeiten der Ressource 'file:///C:/WINNT/SM.XML'. Zeile 33, Position 29
Semicolon expected. Are there any special handlings for characters like these?
Thx
Stefan
|
|
|
|
|
Try & or & if you want to show an & character in your output.
|
|
|
|
|
MarSCoZa wrote:
Try & or & if you want to show an & character in your output.
Hi,
thanks for your answer. Could you please provide all sequences for all the five special characters (I think its five) because I don't know where to look for on the web.
Thx a lot!
Stefan
|
|
|
|
|
|
You might want to take a look at the W3C's Blueberry spec on character sets in XML.
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
I have some code I wrote ages ago, and now it won't run on my machine at work ( but it runs on everyone elses ). I have IE6 and we've found conversely that ome of my XSL *only* ran on my machine. The problem is when I have a list of nodes, all siblings, and I loop through them and use appendChild to cut and paste them into another document. It simply blows up. Any suggestions ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I'm testing this and not having any problems. Can you post some sample code?
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|