This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Storing HTML in XML
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Storing HTML in XML
- From: Michael Symonds <MSymondsMaillists at epost dot de>
- Date: Thu, 06 Sep 2001 21:01:46 +0200
- Organization: Privat
- References: <4AD94ABEB713D411B1E300A0C99599261B26ED@mail.bowneglobal.es>
- Reply-To: xsl-list at lists dot mulberrytech dot com
On Thu, 6 Sep 2001 19:16:33 +0200 , you wrote:
>I would like to know if it's possible to store html code inside xml tags.
You can do this with Saxon's output-extension.
Regards - Michael Symonds
P.S. Example tested with Saxon 6.4.3 (the current version):
------------------- stylesheet ------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
extension-element-prefixes="saxon" >
<xsl:output method="html" encoding="ISO-8859-1" />
<xsl:template match="HTML-file" >
<xsl:variable name="outputfilename" >
<xsl:value-of select="normalize-space(filename)" />
</xsl:variable>
<saxon:output href="{$outputfilename}.html" >
<html>
<xsl:apply-templates/>
</html>
</saxon:output>
</xsl:template>
<xsl:template match="filename" >
<head>
<title>
<xsl:apply-templates/>
</title>
</head>
</xsl:template>
<xsl:template match="content" >
<body>
<xsl:apply-templates/>
</body>
</xsl:template>
</xsl:stylesheet>
------------------- /stylesheet ------------------------
------------------- XML-data ------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<HTML-files>
<HTML-file>
<filename>page1</filename>
<content>Text of HTML-page 1</content>
</HTML-file>
<HTML-file>
<filename>page2</filename>
<content>Text of HTML-page 2</content>
</HTML-file>
<HTML-file>
<filename>page3</filename>
<content>Text of HTML-page 3</content>
</HTML-file>
</HTML-files>
------------------- /XML-data ------------------------
-------------- output-file no1: page1.html ------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>page1</title>
</head>
<body>Text of HTML-page 1</body>
</html>
-------------- /output-file no1: page1.html ------------
-------------- output-file no2: page2.html ------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>page2</title>
</head>
<body>Text of HTML-page 2</body>
</html>
-------------- /output-file no2: page2.html ------------
-------------- output-file no3: page3.html ------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>page3</title>
</head>
<body>Text of HTML-page 3</body>
</html>
-------------- /output-file no3: page3.html ------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list