Subject: [xsl] Process XHTML embedded in XML From: Laurent Vaills <laurent.vaills@xxxxxxxxxxxxxx> Date: Fri, 01 Jun 2001 14:06:31 +0200 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: using a parameter as filt, Dimitre Novatchev | Thread | Re: [xsl] Process XHTML embedded in, David Carlisle |
Re: [xsl] using a parameter as filt, Francis Norton | Date | Re: [xsl] Process XHTML embedded in, Dimitre Novatchev |
Month |