[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re; Preseving xhtml tags during a transform
The list ahs helped me make progress with this effort. Particularly advice
from David Carlisle about transitioning from nonamespace to the xhtml
namespace. With that help, I can get html tags within part of my output,
however, now I need to achieve the same in another part. I probably don't
completely understand David's original advice completely, so I may be
misapplying it.
Here is a small sample of the xml document. <?xml version='1.0' ?> <HistoryPages> <page seq="18"> <url>thoreauMentions.html</url> <title>Thoreau Refers to the Middlesex in Walden<title> <content> <p class="content">Some Text</p> <p class="content">In his opening to the chapter "Visitors" in <span class="it">Walden; or, Life in the Woods</span></p> </content> <popup> <text>See the text about "Visitors" in Thoreau's <span class="it">Walden</span></text> <link width="500" height="400">thoreauText.html</link> </popup> </page> </HistoryPages> Here is a representative part of my transform <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" method="html" indent="yes" encoding="ISO-8859-1" /> <xsl:template match="page"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" > <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <link type="text/css" href="../style/storyPages.css" rel="stylesheet"/> <title> <xsl:value-of select="title"/> </title> </head> <body> <xsl:call-template name="pageTitle"/> <xsl:apply-templates mode="xh" select="content/*" /> <xsl:apply-templates select="popup"/> </body> </html> </xsl:template> <xsl:template match="*" mode="xh"> <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml"> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="xh" /> </xsl:element> </xsl:template> <xsl:template name="pageTitle"> <p id="page-title"> <xsl:value-of select="@seq"/>. <xsl:value-of select="title"/> </p> </xsl:template> <xsl:template match="popup"> <xsl:variable name="a" select="link/text()"/> <xsl:variable name="h" select="link/@height"/> <xsl:variable name="w" select="link/@width"/> <xsl:variable name="tip" select="tip"/> <li> <a href="../popups/{$a}"><xsl:value-of select="text"/></a> </li> </xsl:template> </xsl:stylesheet> My desired outcome is that the <span class=it> and </span> tags are preserved. The transform achieves that for the <p class="content"> material, but I can't figure out how to do this for the material in popup. I want to achieve this with the popup template: <li><a href="../popups/thoreauText.html">See the text about “Visitors” in Thoreau’s <span class="it">Walden</span></a></li> However, what I do achieve is this: <li><a href="../popups/thoreauText.html">See the text about “Visitors” in Thoreau’s Walden</a></li> What do I need to do?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|