Komodo javascript xslt output

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Komodo javascript xslt output

David Greene-4
Problem:
omit-xml-declaration="no"
Fails! I can't get the processor to output the xml declaration. Is there
some kind of a "switch" that I have to set on the processor?

I hope someone can answer this... I have the following xslt output
statement:

<xsl:output
    media-type="application/vnd.mozilla.xul+xml"
    encoding="utf-8"
    method="xml"
    indent="no"
    omit-xml-declaration="no"
    standalone="yes"
    doctype-public="-//MOZILLA//DTD XUL V1.0//EN"
    doctype-system="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>

I'm not 100% sure about standalone="yes", I've never used it before but I
was trying anything. I assume it's irrelavent to the problem.

I'm a newbie to Mozilla stuff and Komodo but I think I'm using the
XSLTProcessor referenced here:
http://developer.mozilla.org/en/Using_the_Mozilla_JavaScript_interface_to_XSL_Transformations

I am not a newbie to xslt:
http://www.dlgreene.com
Obviously this link uses MS xslt on the server and NOT in the browser but,
Komodo is a local app and javascript seems to be the best solution at this
time.

so I'm using this statement in Komodo javascript:
var m_Processor = new XSLTProcessor( );

Annoyance:
<xsl:processing-instruction
name="xml-stylesheet">href="chrome://global/skin/"
type="text/css"</xsl:processing-instruction>
This statement outputs a crlf or just lf(not sure which but either one is
wrong) each time I need to output a processing instruction statement. I'm a
stickler for no tabs crs or lfs in my output so now when I actually need the
output I do this:

///////////////////////////////////////////////////////////////////////////////
function xmlDocToXmlString( xmlDoc )
    {
    var xml_declaration = '<?xml version="1.0" encoding="utf-8"?>';
    if( 'yes' == m_omit_xml_declaration )
        xml_declaration = '';
    var _Serializer =
Components.classes['@mozilla.org/xmlextras/xmlserializer;1']
        .createInstance( Components.interfaces.nsIDOMSerializer );

    return xml_declaration + _Serializer.serializeToString(
xmlDoc ).replace( /\n/g, '' );
    }

I probably really don't need to go through all that but, I have found from
experience that browsers do seem to respond differantly with and without
tabs, crs, or lfs ANYWHERE in the output(which is input for the the
browser).

Anyway the above function really messes up the operation... static
encoding... I need a variable in javascript to determine the declaration...
I just want the XSLTProcessor to follow xslt instructions. It is really,
really bad code to have to "override" or "figure out" these things in
javascript.


_______________________________________________
dev-tech-xslt mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xslt