When a document is constrained by a DTD, XXE is *not namespace aware*.

In this mode, 'src:fragment' is a non-qualified XML 1.0 name (has no 
namespace at all) and 'xmlns:src' is an ordinary attribute with no 
special semantics.

In order to solve your problem:
* Convert your DTD to a XML Schema using dtdtoxsd.
* OR, more simply, do the following:

[1] Always use the same prefixes (i.e. do not play with namespaces for 
example by adding xmlns:foo="http://nwalsh.com/xmlns/litprog/fragment"; 
in a nested element).

[2] Remove:

---
@namespace src url(http://nwalsh.com/xmlns/litprog/fragment);
---

from the CSS.

[3] Rewrite your CSS rules as if 'src:fragment' was a non-qualified name:

---
src\:fragment {
      white-space: pre;
      font-family: monospace;
      background-color: #EEEEEE;
      border: thin solid gray;
      padding: 2px;
      margin: 1.33ex 0;
}
---

Note the '\' before the ':'.

John L. Clark wrote:
> Indeed it is.  Thanks, that worked.  Ok, now on to the next
> sure-to-be-brain-dead fix; for some reason the namespace declared in my
> css file (see attached ldocbook.css) is not being picked up.  In
> particular, none of the styles for src:fragment are being applied.  The
> (brief) comments in the style file explain what I'm doing in there, and,
> as before, my template looks like this:
> 
> <?xml version="1.0"?>
> <!DOCTYPE article PUBLIC "-//Normal Walsh//DTD lDocBook//EN"
>     "ldocbook.dtd">
> 
> <article xmlns:src="http://nwalsh.com/xmlns/litprog/fragment";>
>     <section>
>         <title></title>
> 
>         <para></para>
> 
>         <src:fragment id="top"></src:fragment>
>       </section>
> </article>
> 
> And so everything else is coming out styled correctly, but the
> src:fragment is (apparently) being ignored.
> ------------------------------------------------------------------------
> 
> /* Use the shipped style sheets for everything docbook ... */
> 
> @import 
> "/home/john/download/software/xxe-std-23p1/config/sdocbook/css/sdocbook.incl";
> @import 
> "/home/john/download/software/xxe-std-23p1/config/docbook/css/docbook.incl";
> @import 
> "/home/john/download/software/xxe-std-23p1/config/sdocbook/css/print.incl";
> 
> /* ... and add to them our own simple styles for Norman Walsh's literate
>    programming tagset. */
> 
> @namespace src url(http://nwalsh.com/xmlns/litprog/fragment);
> 
> src|fragment
> {
>     white-space: pre;
>     font-family: monospace;
>     background-color: #EEEEEE;
>     border: thin solid gray;
>     padding: 2px;
>     margin: 1.33ex 0;
> }
> 
> /* @import "/home/john/In_progress/DocBook/litprog-1.0/css/xweb.css"; */


Reply via email to