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

Process XHTML embedded in XML

Subject: Process XHTML embedded in XML
From: Laurent Vaills <laurent.vaills@xxxxxxxxxxxxxx>
Date: Fri, 01 Jun 2001 14:06:31 +0200
xhtml embed
Hi.

Here's my problem : I need to embed in my xml document some comment.
What I want is the comment could be written in a subset of xhtml.
Here is a simple example :
<?xml version="1.0" encoding="ISO-8859-1" ?>

<album >
  <page>
    <photo filename="tous-01.jpg">
      <caption xmlns="http://www.w3.org/1999/xhtml">some <b>cool</b>
!!!</caption>
    </photo>
  </page>
</album>

by describing the document like this I am unable to get the content of
the caption element in my XSL Stylesheet.

Here is my xsl stylesheet :
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >

<xsl:output method="html"  <--- html or xml ???
            indent="yes"
            encoding="ISO-8859-1"
            doctype-public= "-//W3C//DTD XHTML 1.0 Transitional//EN" />

  <xsl:template match="/">
    <html lang="fr" >
      <head>
          ...
      </head>
    
      <body bgcolor="white">
        <xsl:apply-templates select="album/page"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="page">
    <xsl:apply-templates select="photo"/>
  </xsl:template>

  <xsl:template match="photo">
       <xsl:element name="table">
         <xsl:element name="tr">
                <xsl:element name="td"> 
             <xsl:attribute name="align">center</xsl:attribute>
             <xsl:attribute name="width">100</xsl:attribute>
             <xsl:attribute name="height">100</xsl:attribute>
             <xsl:element name="img">
               <xsl:attribute name="src">
                <xsl:value-of select="@filename"/>
            </xsl:attribute>
               <xsl:attribute name="alt">
                <xsl:value-of select="@filename"/>
            </xsl:attribute>
             </xsl:element>
                </xsl:element>
         </xsl:element>
         <xsl:element name="tr">
                <xsl:element name="td"> 
             <xsl:attribute name="align">center</xsl:attribute>
          <xsl:apply-template select="caption" />
                </xsl:element>
         </xsl:element>
       </xsl:element>
        </xsl:element>
      </xsl:element>
    </xsl:element>
  </xsl:template>

  <xsl:template match="caption">
        <font color="white"><i><xsl:value-of select="."/></i></font>
  </xsl:template>

</xsl:stylesheet>

The only way to get content of caption element was to write it as a
CDATA (i.e. <caption><![CDATA[some <b>cool</b> text !!!]]</caption>.
(as described in a mail from mike@xxxxxxxx in august 2000)

What I want is :
1) get the content of caption without qualifying it as CDATA but using
xmlns, which I think is proper.
2) check the content I got is well formed in my xsl stylesheet.

Sorry for this long post.
Hope to describe my problem correctly.
If you want more information, please ask me.

Thanks.

PS : I'm using xalanJ 2.0.1
-- 
Laurent Vaills
Sun Microsystems (Grenoble, France) - Intern
Office Phone : +33 (0) 4 76 18 81 09

 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.