ppauluss Posted January 24, 2006 Share Posted January 24, 2006 Hi there,I have a process that dynamically extracts an HTML block from XHTML content using XSLT. It simply uses xsl:copy-ofThis works perfectly, except for special characters.An example: © is not being processed, while the numeric equivalent works perfectly.Any suggestions on solving this problem?Kind Regards,PeterXHTML example<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml<head><title></title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><base href="http://dev.xxx.com:9940/" /></head><body><div id="parameters"> <table width="520" id="SiteParams" border="1"> <tr> <th width="243"><p>Parameter Name</p> <p> </p></th> <th width="265"><p>Parameter Value</p> <p> </p></th> </tr> <!-- InstanceBeginRepeat name="Site" --><!-- InstanceBeginRepeatEntry --> <tr> <td height="33" valign="top">Site</td> <td id="site"><!-- InstanceBeginEditable name="site" -->www.depuyorthopaedics.com<!-- InstanceEndEditable --></td> </tr> <!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat --> </table> <br /><br /></div> <div id="pagecontent"> <!-- InstanceBeginEditable name="pagecontent" --> <p class="heading1">Educational Opportunities </p> <br /> <p>Copyright: ©</p> <p>Registered: ®</p> <p>Ampersand: &</p> <!-- InstanceEndEditable --> </div></body><!-- InstanceEnd --></html>XSL<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:x="http://www.w3.org/1999/xhtml"> <xsl:output method="html" /> <xsl:template match="/"> <xsl:copy-of select="/*/*/*[@id and (@id="pagecontent")]" /> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
boen_robot Posted January 24, 2006 Share Posted January 24, 2006 Special entities like © must be declared in the stylesheet somehow. You may use either DTD or schema. Both should do the trick. I haven't got deep into schema yet, but here's a DTD that Dreamwaver offers(it should work): <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> <!ENTITY copy "©"> <!ENTITY reg "®"> <!ENTITY trade "™"> <!ENTITY mdash "—"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY pound "£"> <!ENTITY yen "¥"> <!ENTITY euro "€">]> Just put it right after the XML declaration(before the xsl:stylesheet). As you can see it contains other special entities. You can always define other entities as well. Link to comment Share on other sites More sharing options...
ppauluss Posted January 25, 2006 Author Share Posted January 25, 2006 Thanks, I adapted the stylesheet, but it doesn't do the trick.I do not know how I would be able to use a DTD since the 'input' XHTML file already has a xhtml1-transitional.dtd assigned to it.Other suggestions?Kind Regards,Peter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now