RE: [docbook-apps] suppressing everything but the content of body in xhtml output
-Original Message- From: Brett Leber Your XSL works, but I get the following at the top of the file, which I'd also like to suppress: ?xml version=1.0 encoding=UTF-8? !DOCTYPE div PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;\ How can I do that? You can't do that using XSLT. The DOCTYPE declaration comes from xsl:output in xhtml/docbook.xsl. There is no way of completely suppressing it in a customization layer. You can do this: xsl:output omit-xml-declaration=yes doctype-public= doctype-system=/ But that will still leave !DOCTYPE div PUBLIC in the output. /MJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook-apps] suppressing everything but the content of body in xhtml output
MJ, Thanks very much. Brett On 6/26/2007 10:43 AM, Mauritz Jeanson wrote: -Original Message- From: Brett Leber Your XSL works, but I get the following at the top of the file, which I'd also like to suppress: ?xml version=1.0 encoding=UTF-8? !DOCTYPE div PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;\ How can I do that? You can't do that using XSLT. The DOCTYPE declaration comes from xsl:output in xhtml/docbook.xsl. There is no way of completely suppressing it in a customization layer. You can do this: xsl:output omit-xml-declaration=yes doctype-public= doctype-system=/ But that will still leave !DOCTYPE div PUBLIC in the output. /MJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook-apps] suppressing everything but the content of body in xhtml output
One small correction. You can't do it with a customization layer, because of the way xsl:output elements are combined. I had some correspondence with Michael Kay about Saxon's behavior, and he says that once you have the doctypes declared, there is no way to completely undeclare them in a customization layer. But you can edit the original xhtml/docbook.xsl file to remove the doctype attributes from the xsl:output there. Ugly, and a maintenance headache, but it is possible. The xsl:output element's attributes in XSLT 1.0 must always be literals. You can't use parameter values to set them, so they can't be made conditional. XSLT 2.0 adds named output declarations that can be conditional. Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Mauritz Jeanson [EMAIL PROTECTED] To: 'Brett Leber' [EMAIL PROTECTED]; 'Bob Stayton' [EMAIL PROTECTED] Cc: docbook-apps@lists.oasis-open.org Sent: Tuesday, June 26, 2007 7:43 AM Subject: RE: [docbook-apps] suppressing everything but the content of body in xhtml output -Original Message- From: Brett Leber Your XSL works, but I get the following at the top of the file, which I'd also like to suppress: ?xml version=1.0 encoding=UTF-8? !DOCTYPE div PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;\ How can I do that? You can't do that using XSLT. The DOCTYPE declaration comes from xsl:output in xhtml/docbook.xsl. There is no way of completely suppressing it in a customization layer. You can do this: xsl:output omit-xml-declaration=yes doctype-public= doctype-system=/ But that will still leave !DOCTYPE div PUBLIC in the output. /MJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook-apps] suppressing everything but the content of body in xhtml output
Bob, Thanks for the reply. I would say it's commonly done, but that is only my suspicion based on what I've seen on the Web. Naked HTML makes sense, although it doesn't convey that the output is an HTML fragment. (Plus some identify naked HTML as HTML with no CSS.) I like the explicit content-of-body or body-only, or the Tidy parameter show-body-only. Your XSL works, but I get the following at the top of the file, which I'd also like to suppress: ?xml version=1.0 encoding=UTF-8? !DOCTYPE div PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;\ How can I do that? Thanks! Brett On 6/15/2007 5:47 PM, Bob Stayton wrote: Hi, It's possible with customization. If it is commonly done, it could be incorporated as a feature. Got a name for this? Naked HTML? You will need to customize the template that generates the HTML wrapper elements. If you are using the nonchunking stylesheet, you want to customize the template with mode=process.root in html/docbook.xsl. If you are using the chunking stylesheet, you need customize the template named chunk-element-content in html/chunk-common.xsl. In both cases, you want to eliminate all those parts of the template that output the HTML elements you do not want. If you want to eliminate just the HEAD, then remove the literal head and /head tags and their content. If you want completely bare content, then remove the html, head, and body tags, as well as the template calls that fill the head element and generate the header and footer. There will not be much left. For example, process.root could end up looking like the following: xsl:template match=* mode=process.root xsl:call-template name=root.messages/ xsl:apply-templates select=./ /xsl:template Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Brett Leber [EMAIL PROTECTED] To: docbook-apps@lists.oasis-open.org Sent: Friday, June 15, 2007 2:01 PM Subject: Re: [docbook-apps] suppressing everything but the content of body in xhtml output I'm a little bit disappointed that there weren't any more responses to this question (besides Dick's very useful suggestion). Do most people publishing DocBook in (X)HTML use the output as the entire page page on the server? I would think the opposite, that most people would *include* the docbook output in the templating system of a site. Tidy is one way forward. But can't we do a little better by outputting only the useful content (the content of the body element, most likely) for inclusion in a page? Thanks, Brett On 6/12/2007 3:24 PM, Dick Hamilton wrote: Brett, I needed to do the same thing, but I cheated and used tidy with the following configuration file: show-body-only: yes output-xhtml: yes You can also merge divs and clean up other artifacts pretty easily. I'm sure there's a way to do this in the transform, but if you need a quick fix, tidy works pretty well. If you're not familiar with tidy, check out tidy.sourceforge.net. Dick Hamilton -Original Message- From: Brett Leber [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 1:05 PM To: docbook-apps@lists.oasis-open.org Subject: [docbook-apps] suppressing everything but the content of body in xhtml output Hello, I'd like to output only the content of the xhtml document's body (ie, no html, head, or body tags). I found an old post that seemed to be what I needed, but the XSL customization didn't work for me (granted, it's 5 years old): Subject: Re: DOCBOOK-APPS: Removing html,head body * From: Gisbert Amm [EMAIL PROTECTED] * To: Fredrik Svensson [EMAIL PROTECTED] * Date: Wed, 04 Sep 2002 10:21:26 +0200 Currently the HTML head stuff is output by this template in html/docbook.xsl: xsl:template match=* mode=process.root If you only want to modify this for articles, you could add a template in mode process.root to your html customization layer: xsl:template match=article mode=process.root xsl:apply-templates select=./ /xsl:template Then it will not output the headbody stuff, but it will process everything in the document as html. I'm using the DocBook 5 stylesheets, and xhtml/docbook.xsl. Any hints? thanks, Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook-apps] suppressing everything but the content of body in xhtml output
Hendrik, Not stupid at all :) I'm fairly new to XSL, and the thought hadn't occurred to me. Thanks, Brett On 6/15/2007 5:48 PM, Hendrik Bunke wrote: This may be stupid, but why don't you just do another transformation with one simple XSL-File (something like xsl:copy-of select=/html/body/node() /? hendrik bunke --On Fri, 15 Jun 2007 17:01, Brett Leber wrote: I'm a little bit disappointed that there weren't any more responses to this question (besides Dick's very useful suggestion). Do most people publishing DocBook in (X)HTML use the output as the entire page page on the server? I would think the opposite, that most people would *include* the docbook output in the templating system of a site. Tidy is one way forward. But can't we do a little better by outputting only the useful content (the content of the body element, most likely) for inclusion in a page? Thanks, Brett On 6/12/2007 3:24 PM, Dick Hamilton wrote: Brett, I needed to do the same thing, but I cheated and used tidy with the following configuration file: show-body-only: yes output-xhtml: yes You can also merge divs and clean up other artifacts pretty easily. I'm sure there's a way to do this in the transform, but if you need a quick fix, tidy works pretty well. If you're not familiar with tidy, check out tidy.sourceforge.net. Dick Hamilton -Original Message- From: Brett Leber [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 1:05 PM To: docbook-apps@lists.oasis-open.org Subject: [docbook-apps] suppressing everything but the content of body in xhtml output Hello, I'd like to output only the content of the xhtml document's body (ie, no html, head, or body tags). I found an old post that seemed to be what I needed, but the XSL customization didn't work for me (granted, it's 5 years old): Subject: Re: DOCBOOK-APPS: Removing html,head body * From: Gisbert Amm [EMAIL PROTECTED] * To: Fredrik Svensson [EMAIL PROTECTED] * Date: Wed, 04 Sep 2002 10:21:26 +0200 Currently the HTML head stuff is output by this template in html/docbook.xsl: xsl:template match=* mode=process.root If you only want to modify this for articles, you could add a template in mode process.root to your html customization layer: xsl:template match=article mode=process.root xsl:apply-templates select=./ /xsl:template Then it will not output the headbody stuff, but it will process everything in the document as html. I'm using the DocBook 5 stylesheets, and xhtml/docbook.xsl. Any hints? thanks, Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook-apps] suppressing everything but the content of body in xhtml output
Hi, It's possible with customization. If it is commonly done, it could be incorporated as a feature. Got a name for this? Naked HTML? You will need to customize the template that generates the HTML wrapper elements. If you are using the nonchunking stylesheet, you want to customize the template with mode=process.root in html/docbook.xsl. If you are using the chunking stylesheet, you need customize the template named chunk-element-content in html/chunk-common.xsl. In both cases, you want to eliminate all those parts of the template that output the HTML elements you do not want. If you want to eliminate just the HEAD, then remove the literal head and /head tags and their content. If you want completely bare content, then remove the html, head, and body tags, as well as the template calls that fill the head element and generate the header and footer. There will not be much left. For example, process.root could end up looking like the following: xsl:template match=* mode=process.root xsl:call-template name=root.messages/ xsl:apply-templates select=./ /xsl:template Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Brett Leber [EMAIL PROTECTED] To: docbook-apps@lists.oasis-open.org Sent: Friday, June 15, 2007 2:01 PM Subject: Re: [docbook-apps] suppressing everything but the content of body in xhtml output I'm a little bit disappointed that there weren't any more responses to this question (besides Dick's very useful suggestion). Do most people publishing DocBook in (X)HTML use the output as the entire page page on the server? I would think the opposite, that most people would *include* the docbook output in the templating system of a site. Tidy is one way forward. But can't we do a little better by outputting only the useful content (the content of the body element, most likely) for inclusion in a page? Thanks, Brett On 6/12/2007 3:24 PM, Dick Hamilton wrote: Brett, I needed to do the same thing, but I cheated and used tidy with the following configuration file: show-body-only: yes output-xhtml: yes You can also merge divs and clean up other artifacts pretty easily. I'm sure there's a way to do this in the transform, but if you need a quick fix, tidy works pretty well. If you're not familiar with tidy, check out tidy.sourceforge.net. Dick Hamilton -Original Message- From: Brett Leber [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 1:05 PM To: docbook-apps@lists.oasis-open.org Subject: [docbook-apps] suppressing everything but the content of body in xhtml output Hello, I'd like to output only the content of the xhtml document's body (ie, no html, head, or body tags). I found an old post that seemed to be what I needed, but the XSL customization didn't work for me (granted, it's 5 years old): Subject: Re: DOCBOOK-APPS: Removing html,head body * From: Gisbert Amm [EMAIL PROTECTED] * To: Fredrik Svensson [EMAIL PROTECTED] * Date: Wed, 04 Sep 2002 10:21:26 +0200 Currently the HTML head stuff is output by this template in html/docbook.xsl: xsl:template match=* mode=process.root If you only want to modify this for articles, you could add a template in mode process.root to your html customization layer: xsl:template match=article mode=process.root xsl:apply-templates select=./ /xsl:template Then it will not output the headbody stuff, but it will process everything in the document as html. I'm using the DocBook 5 stylesheets, and xhtml/docbook.xsl. Any hints? thanks, Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [docbook-apps] suppressing everything but the content of body in xhtml output
Brett, I needed to do the same thing, but I cheated and used tidy with the following configuration file: show-body-only: yes output-xhtml: yes You can also merge divs and clean up other artifacts pretty easily. I'm sure there's a way to do this in the transform, but if you need a quick fix, tidy works pretty well. If you're not familiar with tidy, check out tidy.sourceforge.net. Dick Hamilton -Original Message- From: Brett Leber [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 1:05 PM To: docbook-apps@lists.oasis-open.org Subject: [docbook-apps] suppressing everything but the content of body in xhtml output Hello, I'd like to output only the content of the xhtml document's body (ie, no html, head, or body tags). I found an old post that seemed to be what I needed, but the XSL customization didn't work for me (granted, it's 5 years old): Subject: Re: DOCBOOK-APPS: Removing html,head body * From: Gisbert Amm [EMAIL PROTECTED] * To: Fredrik Svensson [EMAIL PROTECTED] * Date: Wed, 04 Sep 2002 10:21:26 +0200 Currently the HTML head stuff is output by this template in html/docbook.xsl: xsl:template match=* mode=process.root If you only want to modify this for articles, you could add a template in mode process.root to your html customization layer: xsl:template match=article mode=process.root xsl:apply-templates select=./ /xsl:template Then it will not output the headbody stuff, but it will process everything in the document as html. I'm using the DocBook 5 stylesheets, and xhtml/docbook.xsl. Any hints? thanks, Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]