|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: generate XHTML header without causing xmlns attrib
I'm also using xalan-j, and I've used this sort of code to avoid the empty
namespace
declaration: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:oeb="http://openebook.org/namespaces/oeb-document/1.0/" exclude-result-prefixes="oeb"> ... <xsl:template match="/"> <xsl:element name="html" xmlns="http://openebook.org/namespaces/oeb-document/1.0/"> ... </xsl:template> ... <xsl:template match="LINK"> <xsl:choose> <xsl:when test="@TYPE='URL'"> <a xmlns="http://openebook.org/namespaces/oeb-document/1.0/"> <xsl:attribute name="href"><xsl:value-of select="@DEST"/></xsl:attribute> <xsl:apply-templates /> </a> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> *** As I understand it, because you've named the XHTML namespace as the null-prefix namespace, and you've assigned the elements in your stylesheet to that namespace (by not putting a prefix on them or explicitly assigning them to something), XSLT is concluding that the output elements belong to that null-prefix namespace. I'm working around that by explicitly assigning them to the namespace that I'm excluding from my results. I still use the null-prefix namespace declaration in my output by declaring it in the html element above. You'd just need to replace my uses of oeb with your uses of XHTML. I've had good results with this -- hope it helps! At 09:24 AM 10/17/03, you wrote: > > But the resulting table tag in XHTML is: > > <table xmlns="" class="parameters" cellspacing="0" > > cellpadding="3" border="1"> > > <thead> > > <tr> > > ... > > > This code looks perfectly correct to me. > > This means either: > * I haven't spotted your error, or > * There is something odd in a part of the stylesheet you > haven't shown us, or > * you are using a buggy XSLT processor (unlikely if you are > using one of the widely-used ones, but I don't think you told > us which one it was). > > The next thing I would do is to run it against a different > processor and see if the results are the same. > --Chris ---------------------------------------------------------------------------------------- Texterity ~ Digital Delivery Made Simple ---------------------------------------------------------------------------------------- Chris Loschen, XML Developer Texterity, Inc. 144 Turnpike Road Southborough, MA 01772 USA tel: +1.508.804.3033 fax: +1.508.804.3110 email: loschen@xxxxxxxxxxxxx http://www.texterity.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








