P
Paul Verbelen
I have a file with topics. I like to copy them in
another file but want to have some blank lines
between the different topics. I use <xsl:text>
element with as data some blank lines to perform
this. To clarify my question, I have add all the
files required to perform the test.
First question: Why doesn't this works anymore
if I remove the line with " " in the
XSL-file ?
Second question: The [CDATA[ data in the XML-file
is converted in my output file (< becomes <, etc.)
Is there a way to avoid this? I like to keep the
[CDATA[ syntax because it's more readable.
I have following script "test.js":
var myXml = "test.xml";
var myXsl = "test.xsl";
var myOut = "test.out";
var rSourceDoc,rStyleDoc;
var fso, f, ts, s;
rSourceDoc = new ActiveXObject("microsoft.xmldom");
rSourceDoc.async="false";
rSourceDoc.load(myXml);
rStyleDoc = new ActiveXObject("microsoft.xmldom");
rStyleDoc.async="false";
rStyleDoc.load(myXsl);
fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CreateTextFile(myOut);
f = fso.GetFile(myOut);
ts = f.OpenAsTextStream(2);
ts.Write( rSourceDoc.transformNode(rStyleDoc) );
ts.Close( );
Which I run with batch "run.cmd":
cscript test.js
The data file "test.xml" is:
<?xml version="1.0"?>
<topicDb>
<topic>
This is a <b>test</b>
</topic>
<topic><![CDATA[
<H1>Titel</H1>
]]></topic>
</topicDb>
And the xsl file "test.xsl" is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" version="1.0" indent="yes"/>
<xsl:template match="/">
<xsl:element name="topicDb">
<xsl:for-each select="*/topic">
<xsl:copy-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
another file but want to have some blank lines
between the different topics. I use <xsl:text>
element with as data some blank lines to perform
this. To clarify my question, I have add all the
files required to perform the test.
First question: Why doesn't this works anymore
if I remove the line with " " in the
XSL-file ?
Second question: The [CDATA[ data in the XML-file
is converted in my output file (< becomes <, etc.)
Is there a way to avoid this? I like to keep the
[CDATA[ syntax because it's more readable.
I have following script "test.js":
var myXml = "test.xml";
var myXsl = "test.xsl";
var myOut = "test.out";
var rSourceDoc,rStyleDoc;
var fso, f, ts, s;
rSourceDoc = new ActiveXObject("microsoft.xmldom");
rSourceDoc.async="false";
rSourceDoc.load(myXml);
rStyleDoc = new ActiveXObject("microsoft.xmldom");
rStyleDoc.async="false";
rStyleDoc.load(myXsl);
fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CreateTextFile(myOut);
f = fso.GetFile(myOut);
ts = f.OpenAsTextStream(2);
ts.Write( rSourceDoc.transformNode(rStyleDoc) );
ts.Close( );
Which I run with batch "run.cmd":
cscript test.js
The data file "test.xml" is:
<?xml version="1.0"?>
<topicDb>
<topic>
This is a <b>test</b>
</topic>
<topic><![CDATA[
<H1>Titel</H1>
]]></topic>
</topicDb>
And the xsl file "test.xsl" is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" version="1.0" indent="yes"/>
<xsl:template match="/">
<xsl:element name="topicDb">
<xsl:for-each select="*/topic">
<xsl:copy-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>