Tobias Anstett [k15t.com] | 7 Mar 21:57 2009

Highlighting complete areas in DocBook

Hi together,

is there a way to highlight docbook elements in a generic way? I'd
like to be able to put some extra attribute or pi to any docbook
element to highlight it e.g. set the background color of a para
(resulting fo:block) to red for PDF output. I already had a look at
the change highlighting documented at
http://www.sagehill.net/docbookxsl/Changebars.html, but because i am
using Apache FOP i need some other mechanism to highlight docbook
elements (and it childs) ranging from para, admonition,
programmlistings, table, etc. to table.

Cheers, Tobias
Jon Leech | 8 Mar 11:28 2009
Picon

Re: w3.org won't serve DTD imbedded in Docbook generated output - but only to IE

DavePawson wrote:
> Bob Stayton wrote:
>> Below is the mail
>> I sent to the W3C webmaster. I'll let you know if I get an explanation 
>> of this odd behavior.
> 
> http://www.outofcontrol.ca/2009/02/20/w3org-dtdxhtml1-strictdtd-blocks-windows-ie-users/

     BTW, this was written by the opengl.org webmaster - it's the very same
problem I originally asked about here.

> W3C staffer suggests using a catalog... Is that possible with IE?

     In a sense it really doesn't matter whether it is or not, because it is
something that consumers of our documentation would have to be told to do, not
something we can just make work for them. We ended up postprocessing the
generated XHTML to strip the w3c.org path and added cached local copies of
the DTD and .xml files it refers to. Maybe someday Microsoft will issue an
IE fix, or the stylesheets will offer a workaround, or w3c.org will have a
change of heart - but this seems to be the only practical solution for now.
     There's a RISKS posting lurking in here somewhere about invisible
dependencies on external resources that may stop being available,
for whatever reason.
     Jon
Bob Stayton | 8 Mar 18:47 2009
Picon

Re: w3.org won't serve DTD imbedded in Docbook generated output - but only to IE

Actually, postprocessing is not necessary if you are generating chunked 
output.  There is a stylesheet parameter that controls the system doctype 
output to the XHTML files:

<xsl:param name="chunker.output.doctype-system">foofara.dtd</xsl:param>

Bob Stayton
Sagehill Enterprises
bobs <at> sagehill.net

----- Original Message ----- 
From: "Jon Leech" <jon <at> alumni.caltech.edu>
To: <docbook <at> lists.oasis-open.org>
Sent: Sunday, March 08, 2009 3:28 AM
Subject: Re: [docbook] w3.org won't serve DTD imbedded in Docbook generated 
output - but only to IE

> DavePawson wrote:
>> Bob Stayton wrote:
>>> Below is the mail
>>> I sent to the W3C webmaster. I'll let you know if I get an explanation 
>>> of this odd behavior.
>>
>> http://www.outofcontrol.ca/2009/02/20/w3org-dtdxhtml1-strictdtd-blocks-windows-ie-users/
>
>     BTW, this was written by the opengl.org webmaster - it's the very same
> problem I originally asked about here.
>
>> W3C staffer suggests using a catalog... Is that possible with IE?
>
(Continue reading)

David Cramer | 8 Mar 22:40 2009

RE: Highlighting complete areas in DocBook

To avoid needing to customize tons of templates, I do the following for
that situation. This allows us to add role="highlight" to any element
and have it be highlighted yellow. This needs to be in a customization
layer that imports the docbook xsls because it relies on doing an
xsl:apply-imports:

For html (assuming you have something like .remark{ background: yellow;
} in your css):

<xsl:template match="text()[ ancestor::*/ <at> role = 'highlight' ] | xref[
ancestor::*/ <at> role = 'highlight' ]" priority="10"><span
class="remark"><xsl:apply-imports/></span></xsl:template> 

And for fo:

  <xsl:template match="text()[ ancestor::*/ <at> role = 'highlight' ] | xref[
ancestor::*/ <at> role = 'highlight' ]" priority="10">
	<fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format"
background-color="yellow"><xsl:apply-imports/></fo:inline>
  </xsl:template>

David

> -----Original Message-----
> From: Tobias Anstett [k15t.com] [mailto:tobias <at> k15t.com] 
> Sent: Saturday, March 07, 2009 2:57 PM
> To: docbook <at> lists.oasis-open.org
> Subject: [docbook] Highlighting complete areas in DocBook
> 
> Hi together,
(Continue reading)

Tobias Anstett [k15t.com] | 9 Mar 14:13 2009

Re: Highlighting complete areas in DocBook

Hi David,

thanks a lot for this example. I took your input and created some
alternative approach:

	<xsl:template match="*[ <at> role='highlight']" priority="10">
		<xsl:variable name="count">
			<xsl:value-of select="count(ancestor::node()[ <at> role='highlight'])"/>
		</xsl:variable>
		<fo:block>
			<xsl:attribute name="background-color">
				<xsl:choose>
					<!-- first level -->
					<xsl:when test="$count = 0">blue</xsl:when>
					<!-- second level -->
					<xsl:when test="$count = 1">green</xsl:when>
					<!-- third level -->
					<xsl:when test="$count = 2">purple</xsl:when>
					<xsl:otherwise>orange</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:apply-imports />
		</fo:block>
	</xsl:template>

I will test both approaches (yours and mine) with complex nestings of
elements with the role=highlight attribute. What do you think about?

Cheers, Tobias

(Continue reading)

David Cramer | 9 Mar 16:50 2009

RE: Highlighting complete areas in DocBook

Interesting idea about the nesting. Be careful of relying on too many colors if some users are color blind.

I'm afraid you can't match * or it will break when someone does <listitem role="highlight"> and several
other elements that can't be wrapped in a fo:block.

David 

> -----Original Message-----
> From: Tobias Anstett [k15t.com] [mailto:tobias <at> k15t.com] 
> Sent: Monday, March 09, 2009 8:14 AM
> To: David Cramer
> Cc: docbook <at> lists.oasis-open.org
> Subject: Re: [docbook] Highlighting complete areas in DocBook
> 
> Hi David,
> 
> thanks a lot for this example. I took your input and created 
> some alternative approach:
> 
> 	<xsl:template match="*[ <at> role='highlight']" priority="10">
> 		<xsl:variable name="count">
> 			<xsl:value-of 
> select="count(ancestor::node()[ <at> role='highlight'])"/>
> 		</xsl:variable>
> 		<fo:block>
> 			<xsl:attribute name="background-color">
> 				<xsl:choose>
> 					<!-- first level -->
> 					<xsl:when test="$count 
> = 0">blue</xsl:when>
(Continue reading)

Tobias Anstett [k15t.com] | 9 Mar 20:18 2009

Re: Highlighting complete areas in DocBook

Hi David,

> Interesting idea about the nesting. Be careful of relying on too many colors if some users are color blind.

I just used the colors to get a feeling of the block nesting.

> I'm afraid you can't match * or it will break when someone does <listitem role="highlight"> and several
other elements that can't be wrapped in a fo:block.

Yes the <listitem role="highlight"> is a real good argument - I have
to check whether we allow role="highlight" attributes in any docbook
element or not.

I am going to test these things this week and looking forward to give
you feedback.

Cheers,
Tobias
Kate.Wringe | 9 Mar 21:06 2009
Picon

Entities in Docbook 5 rnc


Hello,

I'm trying to upgrade our Docbook 4.2 DTD to Docbook 5 RNC.

In our version 4.2 DTD we included an external entity file that listed
the conditions that we used for condition attribute. Is there a way to link/include external files with the docbook 5 RNC?

For example, is it possible to have a file (eg., myconditions.ent) that defines an attribute such as (e.g,. db.iaconditions12.attributte) that
can be used in the definition of db.condition.attribute?

e.g., File myconditions.ent
db.myondition12.attribute =
   
    ## provides a standard place for application-specific effectivity
    attribute mycondition12 {"asajtools"
                        |"dbadmin"
                        |"mobilink"
                        |"programming"
                        |"sqlref"
                        |"sqlug"
                        |"uldotnet"
                        |"ulfoundations"
                        |"rsguide"}



E.g., I'd like to do something like the following in the Docbook 5 customization file:
db.condition.attribute =
    ## provides a standard place for application-specific effectivity
    attribute condition {mycondition12}

If this is possible, how should I reference the myconditions.ent file  in the Docbook 5 RNC?
And do I need to include a namespace reference in the myconditions.ent file?


Thank you,
Kate
Michael(tm) Smith | 10 Mar 09:38 2009
Picon

Re: w3.org won't serve DTD imbedded in Docbook generated output - but only to IE

For more info on this problem and how the W3C systems deal with it, see:

  http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic

"Grosso, Paul" <pgrosso <at> ptc.com>, 2009-02-23 15:32 -0500:

> This has nothing to do with docbook.
> 
> Send email to webmaster <at> w3.org for something like this.
> 
> But your application probably shouldn't be trying to
> retrieve a resource at that URL.  If everyone always
> hit the W3C server every time they did anything with
> XHTML it would be a disaster, and most likely what
> you are seeing is the result of some code put in by
> the W3C webmaster to prevent just this.
> 
> paul
> 
> > -----Original Message-----
> > From: Jon Leech [mailto:jon <at> alumni.caltech.edu] 
> > Sent: Monday, 2009 February 23 14:25
> > To: docbook <at> lists.oasis-open.org
> > Subject: [docbook] w3.org won't serve DTD imbedded in Docbook 
> > generated output - but only to IE
> > 
> > 
> >      We're having a weird problem with some content generated 
> > by Docbook, such as
> > 
> > http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml
> > 
> >      At some time relatively recently, this has started 
> > failing with IE, although
> > it still works fine with Firefox. Our server admin has chased 
> > this down as far as
> > finding out that when
> > 
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
> > 
> > is fetched with an IE 7 User-Agent, it's rejected by 
> > www.w3.org with the following
> > resulting from the HTTP dialog:
> > 
> > HTTP/1.1 503 Go away
> > Date: Mon, 23 Feb 2009 13:32:48 GMT
> > Server: Apache/2
> > Content-Location: msie7.asis
> > Vary: negotiate,User-Agent
> > TCN: choice
> > Retry-After: 86400
> > Cache-Control: max-age=21600
> > Expires: Mon, 23 Feb 2009 19:32:48 GMT
> > P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
> > Content-Length: 2
> > Connection: close
> > Content-Type: text/plain
> > 
> >      Looking at the P3P document referenced from this doesn't 
> > shown any
> > obvious reason for the error. I tried to figure out an appropriate W3C
> > mailing list to inquire on but there are dozens of them and nothing
> > springs out as being obviously relevant. Has anyone else run 
> > into this?
> > Any idea what's happening and how we might address it?
> > 
> >      Thanks,
> > 
> >      Jon Leech
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: docbook-unsubscribe <at> lists.oasis-open.org
> > For additional commands, e-mail: docbook-help <at> lists.oasis-open.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-unsubscribe <at> lists.oasis-open.org
> For additional commands, e-mail: docbook-help <at> lists.oasis-open.org
> 

--

-- 
Michael(tm) Smith
http://people.w3.org/mike/
Thomas Schraitle | 10 Mar 21:05 2009
Picon

Re: Entities in Docbook 5 rnc

Hi Kate,

Am Montag 09 März 2009 21:06:50 schrieb Kate.Wringe <at> sybase.com:
>
> I'm trying to upgrade our Docbook 4.2 DTD to Docbook 5 RNC.
>
> In our version 4.2 DTD we included an external entity file that listed
> the conditions that we used for condition attribute. Is there a way to
> link/include external files with the docbook 5 RNC?
>
> For example, is it possible to have a file (eg., myconditions.ent) that
> defines an attribute such as (e.g,. db.iaconditions12.attributte) that
> can be used in the definition of db.condition.attribute?

Maybe it's nitpicking, but I wouldn't say "entity file". IMHO what you do is 
customizing DocBook, so it's a customization layer or file. At least that's 
what I've learned from the experts. 
Just to make it precise, otherwise it raises false expectations. :)

> e.g., File myconditions.ent
> db.myondition12.attribute =
>
>     ## provides a standard place for application-specific effectivity
>     attribute mycondition12 {"asajtools"
      ^^^^^^^^^^^^^^^^^^^^^^^
Remove the attribute keyword and its name. See also result below.

>                         |"dbadmin"
>                         |"mobilink"
>                         |"programming"
>                         |"sqlref"
>                         |"sqlug"
>                         |"uldotnet"
>                         |"ulfoundations"
>                         |"rsguide"}
>
> E.g., I'd like to do something like the following in the Docbook 5
> customization file:
> db.condition.attribute =
>     ## provides a standard place for application-specific effectivity
>     attribute condition {mycondition12}
>
> If this is possible, how should I reference the myconditions.ent file  in
> the Docbook 5 RNC?

The other way around: you insert a reference to DocBook 5 into your 
customization file. You load your DocBook 5 Schema into your file and 
overwrite some patterns, or define new ones.

To avoid misleading namings, I would rename your file to myconditions.rnc as 
it is a RNC file. The extention ".ent" symbolizes it has something to do with 
entity declarations which is not the case. I also try to use some DocBook 5 
conventions. The result looks like this (tested in oXygen):

----[ myconditions.rnc ]-----
# perhaps other namespace declarations

db.mycondition12.enumeratation =
  ## provides a standard place for application-specific effectivity
  "asajtools"|
  "dbadmin"|
  "mobilink"|
  "programming"|
  "sqlref"|
  "sqlug"|
  "uldotnet"|
  "ulfoundations"|
  "rsguide"

include "docbook.rnc" {
 db.condition.attribute =
    ## provides a standard place for application-specific effectivity
    attribute condition { db.mycondition12.enumeratation }
}
-----------------------------

> And do I need to include a namespace reference in the myconditions.ent
> file?

You can, but in the above file it is not necessary. For more information about 
customizing DocBook 5, have a look at [1].

Hope that helps,
Tom

----------
[1] http://www.docbook.org/tdg5/en/html/ch05.html

Gmane