Subject: Re: [xsl] remove blank xmlns From: Paul_B_Grimes@xxxxxxxxxx Date: Thu, 2 Aug 2001 10:19:45 -0700 |
Hi Jeni, I'm pretty new at the xsl thing and am having trouble fitting your suggestion into my existing xsl. It seems to me I would need to include the code within the <xsl:template match="p:current_projects"> or in the <xsl:for-each select="p:project">. But as I understand, <xsl:template match=""> cannot be nested within another template (not sure exactly how that works). If you could kick me a little more in the right direction, that would be great. You have helped me tremendously in the past and your help is greatly appreciated. Thanks, Paul Grimes <?xml version="1.0"?> <xsl:stylesheet xmlns:p="x-schema:sortProjects-schema.xml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:template match="/"> ******** Scripts and stuff contained here ******** <xsl:apply-templates select="p:current_projects/p:project" /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <xsl:value-of select="p:description" /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </body> </html> </xsl:template> <xsl:template match="p:current_projects"> <table style="background-color:whitesmoke" border="1" rules="rows" frame="below" bordercolor="steelblue" cellpadding="2" id="data"> <thead> <td><div class="header" onClick="sort('project_title', 'text')">Project <br/>Title<br/></div></td> <td><div class="header" onClick="sort('project_number', 'number')">Project Number</div></td> <td><div class="header" onClick="sort('start_convert', 'number')">Start Date</div></td> <td><div class="header" onClick="sort('completion_convert', 'number')">Completion Date</div> </td> <td><div class="header" onClick="sort('cost', 'number')">Project Cost</div></td> <td><div class="header" onClick="sort('contact_name', 'text')">Contact Name</div></td> <td><div class="header" onClick="sort('contact_number', 'number')">Contact Number</div></td> <td><div class="header" onClick="sort('branch', 'text')">Branch<br /><br /></div></td> </thead> <xsl:for-each select="p:project"> <xsl:sort select="p:project_title" data-type="text"/> <tr> <td><div class="row"><a href="#{generate-id()}"> <xsl:value-of select ="p:project_title"/></a></div></td> <td><div class="row" style ="text-align:right"><xsl:apply-templates select ="p:project_number"/></div></td> <td><div class="row" style ="text-align:right"><xsl:apply-templates select="p:start_date"/></div></td> <td><div class="row" style ="text-align:right"><xsl:apply-templates select ="p:completion_date"/></div></td> <td><div class="row" style="text-align:right"> $<xsl:apply-templates select="p:cost"/></div></td> <td><div class="row"><xsl:value-of select ="p:contact_name"/></div></td> <td><div class="row" style ="text-align:right"><xsl:apply-templates select ="p:contact_number"/></div></td> <td><div class="row"><xsl:value-of select ="p:branch"/></div></td> </tr> <tr> <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> </tr> </xsl:for-each> </table> <br /><br /><br /><br /> </xsl:template> <xsl:template match="p:project"> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <h2> <a name="{generate-id()}" id="{generate-id()}"> <xsl:value-of select="p:project_title" /> </a> </h2> <xsl:apply-templates select="p:description" /><br /><br /><br /><br /> <center><u><font color="blue"><div onClick="history.go(-1)">Click Here to go Back to the Project Listing</div></font></u></center> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </xsl:template> <xsl:template match="p:cost"> <xsl:value-of select="format-number(., '##0.00')"/> </xsl:template> </xsl:stylesheet> Jeni Tennison <mail@xxxxxxxxxxxxxxxx>@lists.mulberrytech.com on 08/02/2001 09:05:28 AM Please respond to xsl-list@xxxxxxxxxxxxxxxxxxxxxx Sent by: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: Paul_B_Grimes@xxxxxxxxxx cc: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] remove blank xmlns Hi Paul, > I am using asp to append to an existing xml file. I have set > resolveExternals = False . This seems to work fine as far as leaving > my xsl and schema references in place. My problem is that when > resolveExternals = False, a blank namespace call is inserted. How > can I stop this from showing up? or remove it from asp? Here is an > example of what is happening: It looks as though the ASP is appending elements in no namespace rather than appending them in the x-schema:sortProjects-schema.xml namespace that the elements in your original source document are in. The best solution would be to adjust the ASP code so that it adds the elements in the correct namespace. You need to create all the elements with something like: document.createNode(1, 'project', 'x-schema:sortProjects-schema.xml'); If you can't change the ASP code, then you could use a transformation in a stylesheet that creates equivalent elements in the 'x-schema:sortProjects-schema.xml' namespace whenever it comes across one in no namespace (and copies anything already in the 'x-schema:sortProjects-schema.xml' namespace directly). This stylesheet looks something like: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="ns" select="'http:x-schema:sortProjects-schema.xml'" /> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <xsl:template match="*[not(namespace-uri())]"> <xsl:element name="{local-name()}" namespace="{$ns}"> <xsl:apply-templates select="@*|node()" /> </xsl:element> </xsl:template> </xsl:stylesheet> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] remove blank xmlns, Jeni Tennison | Thread | Re: [xsl] remove blank xmlns, Jeni Tennison |
[xsl] Re:Consecutive page numbering, Drew Hodge | Date | [xsl] Error message, Carlos Durand Silves |
Month |