several questions on XML to HTML processing with XSL

Subject: several questions on XML to HTML processing with XSL
From: H.vanderLinden@xxxxxxxxxxxxx
Date: Fri, 09 Jun 2000 11:45:40 +0200

I've tried to find my answers in the archives, but didn't succeed.

I want my website based on XML files which are translated into
browser-dependent HTML by using XSLT and SAXON 5.3.2. I've managed to get
quite far but now I end up with problems I can't seem to solve.

1. I want to output <LAYER ID='something'><!-- some HTML goes here
--></LAYER> when I find the browser is
Netscape 4+ and <DIV ID='something'><!-- some HTML goes here --></DIV> when
the browser is Internet Explorer 4+.
I prefer to have both versions handled by one XSL sheet so I've tried
something like this, but it fails to work:

<xsl:variable name="browser"><!-- some mechanism to decide which browser is
used --></xsl:variable>

<xsl:variable name="PageSection">DIV</xsl:variable>
<xsl:if test="$browser='NC4'>
   <saxon:assign name="PageSection">LAYER</saxon:assign>

<xsl:value-of select="<$PageSection ID='someID'>"/>
	<!-- some HTML goes here -->
</xsl:value-of select="</$PageSection>"/>

2. I want to allow (well-formed) HTML in my XML file which I want to output
as is in my HTML file, how should I go about? E.g. I want this in my XML
file and out to HTML in the same way:

<!-- lots of XML goes here -->

<DIV ID='something' width='10' height='20'>
    <IMG src='img.jpg'>
    <P>caption text goes here</P>

<!-- more XML goes here -->

3. If I include an HTML tag as valid XML tag in my XML file, how do I output
all attributes with their values?
E.g. I include <TABLE> in my XML file and I want to add (valid HTML)
attributes like width, height etc. which I
want to include in my HTML output.
What should be the appropriate XSL code?

If these questions have been answered in the past, please point me to the
correct URL.

Thanks in advance.


Helma van der Linden
Medical Informatics

 XSL-List info and archive:

Current Thread