[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Storing HTML in XML

Subject: Re: Storing HTML in XML
From: Michael Symonds <MSymondsMaillists@xxxxxxxx>
Date: Thu, 06 Sep 2001 21:01:46 +0200
storing html in xml
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.