Subject: Re: [xsl] Exclude Doctype for output HTML|
From: "Karl Stubsjoen" <kstubs@xxxxxxxxx>
Date: Mon, 5 Nov 2007 14:13:30 -0700
Hi Scott, I dont' mean to imply that I'm doing it in reverse order, I think I am doing it as you have described. For clarification I have: Ajax Template imports.. Page Template imports.. Base Template In the base template I have output method = html and doctype argument filled in. In page template, I'm assuming this inherits the base template output method. In the Ajax template, I'm assuming this inherits the page template which inherits the base template output method and doctype. To overcome the doctype output, I specificy in the Ajax template that the output should be HTML but with no doctype specification. This is not working as expected. As it turns out, IE does not do well in an Ajax request when you are returning html elements without a parent element. So a bunch of <option></option> elements throws off IE. Instead, and as a workaround I am returning <select><option></option></select>. Problem solved. So I am wondering, this must be an IE issue, as it is not an issue in Firefox. Anyone else have any clues as to this behaviour? Thanks, Karl.. On 11/5/07, Scott Trenda <Scott.Trenda@xxxxxxxx> wrote: > So you're essentially doing the imports in reverse from the order that > I'd recommended. As far as I know, the .NET processor is doing it > correctly. If you're not specifying a doctype in the main template, the > XSLT processor looks for one in any of the imported stylesheets, which > is where it's getting it from. Try specifying this in your AJAX > stylesheet first: > <xsl:output method="html" doctype-public="" doctype-system=""/> > > If that doesn't work, take a shot at the other order of imports that I'd > recommended before. > > ~ Scott > > > -----Original Message----- > From: Karl Stubsjoen [mailto:kstubs@xxxxxxxxx] > Sent: Monday, November 05, 2007 2:53 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] Exclude Doctype for output HTML > > Ok, I am imorting my base template, and am overriding the root > template match for the Ajax request. I have an xsl:output method to > HTML with no doctype specification here, but it does exist in the > imported template. So effectively, I am doing what you are > suggesting. Is it the .NET processor throwing that in there? > Could it be, that with no top level element, that the .NET processor > doens't process this properly? > > Karl.. > > On 11/5/07, Scott Trenda <Scott.Trenda@xxxxxxxx> wrote: > > I'm assuming that by "base template", you mean you have a main > > stylesheet that does the bulk of your transforms, and that stylesheet > > accepts a parameter that specifies which part of the stylesheet you > want > > to use for your output. And one of those parts produces the option > list > > you described below. > > > > If that's the case, then the answer is no. Only one output method can > be > > declared per stylesheet. You'll need to split off the <option> section > > into its own stylesheet, and that stylesheet can have <xsl:output > > method="html"/> without any doctype declarations. You can use that one > > for your AJAX transformation. However, if that <option> section is > > needed in the base stylesheet, you could import it via an > <xsl:import>; > > in that case, the templates defined within the <option> stylesheet > will > > be available to the base, and the base stylesheet will output with the > > correct doctypes as you'd specified; the <xsl:output method="html"/> > > from the imported stylesheet will be overwritten by the <xsl:output/> > in > > the base stylesheet. > > > > Hope that helps! > > > > ~ Scott > > > > > > -----Original Message----- > > From: Karl Stubsjoen [mailto:kstubs@xxxxxxxxx] > > Sent: Monday, November 05, 2007 1:16 PM > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: [xsl] Exclude Doctype for output HTML > > > > I need to exclude the doctype decleration from the output for HTML. > > There is a base template which sets the output type to HTML and > > includes a doctype decleration there, but in the child template I need > > to override and exclude the doctype output. Is this possible. > > > > Platform: .NET 2.0 XSLT 1.0 > > > > The problem: For an Ajax request, I need to return the <option> > > elements for my selector element. IE does not care to well for the > > additional doctype decleration in the selector element. So I'm > > getting: > > doctype + <options>...</option><option>...</option> > > > > Thanks, > > > > Karl..