Hi,
I am try to use XML/XSL to generate ASP pages. I already have code which works for normal HTML:
set xmlHTML = Server.CreateObject("Micro
soft.XMLDO
M")
set xslDoc = Server.CreateObject("Micro
soft.XMLDO
M")
set xmlDoc = Server.CreateObject("Micro
soft.XMLDO
M")
xmlDoc.load(Server.Mappath
(xml))
xslDoc.load(Server.Mappath
(xsl))
xmlDoc.transformNodetoObje
ct xslDoc, xmlHTML 'Create procesed HTML file
xmlHTML.save(Server.Mappat
h("out.htm
l"))
This code is being used to impliment a back office content editor and avoid a DB as the the stucture is too non-regular. This way I can generate static HTML and avoid the mergeing of XML/XSL for each request. (yes thera are ways to do all this and use a DB, but I prefer this).
My problem is that some pages need to include ASP pages as they are dynamic at "run time" providing searches and orders linked to a product database. The dificulty is in getting transformNodetoObject to correctly output "<% %>" tags. I gave tried CDATA sections both within the XSL or as the text of a XML node to be inserted at some plase in the XSL, and also using
<xsl:text disable-output-escaping="y
es"><%<
/xsl:text>
, and even trying to be
inventive as in:
<xsl:value-of disable-output-escaping="y
es" select=">"/>
And both the alternatives with literal "<%" but all to no avail. My only results are to produce a file with html encoded lt and gt or an "Unknown error" upon running the code, obviously due to attempted transformation for the "tag".
Can anyone help? Below are examples of my XML and XSL. I have tried working with other names spaces and even investigated the MSXML name space but found nothing to help.
THANKS!!!!
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="
http://www.w3.org/TR/WD-xsl"
xmlns="
http://www.w3.org/1999/XSL/Transform"
result-ns="">
<!-- <xsl:output method="html" cdata-section-elements=""/
> -->
<!-- Root template -->
<xsl:template match="/">
<html>
<head>
<title>TEST 2</title>
</head>
<body>
<xsl:apply-templates select="/page/*"/>
<!-- <xsl:value-of disable-output-escaping="y
es" select="/page/aspOpen/text
()"/> -->
<!-- <xsl:value-of disable-output-escaping="y
es" select=">"/> -->
<!-- <xsl:text> <![CDATA[<% Response.Write("Hello From ASP") %>]] </xsl:text> -->
<!-- <xsl:comment>// <![CDATA[<% ]]> Response.Write("Hello From ASP") <![CDATA[ %>]]> \\</xsl:comment> -->
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<page>
<textarea1 id="menuItem1" rows="30" cols="30">Big long textarea</textarea1>
<text id="title">TextBox</text>
<aspOpen><![CDATA[<%]]></a
spOpen>
<aspClose><![CDATA[>%]]
></aspClos
e>
</page>