[Petal] XIncludes problem and question

Jean-Michel Hiver jhiver at mkdoc.com
Fri Feb 14 14:29:42 GMT 2003


> That's good to know. I think what is confusing me are all the options
> and interacting documents. I started reading about XML namespaces on
> DevShed.com. I just don't have the big picture yet and all the little
> details are getting muddled up in my head. It's encouraging to keep
> getting the little insights from using Petal and talking with you all.

Well, as I understand it namespaces are a way to mix different XML
formats into the same XML file.


For example you could decide to write the following:

<william:foo>
  <william:baz>SomeStuff</william:baz>
  <william:biz>SomeiMoreStuff</william:biz>
</william:foo>

But what if another 'william' comes around?
So, you use a URI as a namespace identifier.


So the piece of XML above could become:

<william:foo xmlns:william="http://www.knowmad.com/namespaces/1.0">
  <william:baz>SomeStuff</william:baz>
  <william:biz>SomeiMoreStuff</william:biz>
</william:foo>


But 'william' is a bit long to type... since the namespace is defined
by the URI, you could change 'william' to 'W'

<W:foo xmlns:W="http://www.knowmad.com/namespaces/1.0">
  <W:baz>SomeStuff</W:baz>
  <W:biz>SomeiMoreStuff</W:biz>
</W:foo>


Or you could just avoid using prefixes by making your namespace the
default one:

<foo xmlns="http://www.knowmad.com/namespaces/1.0">
  <baz>SomeStuff</baz>
  <biz>SomeiMoreStuff</biz>
</foo>


I hope this simple example clears things up a little bit.
Or maybe I'm just all messed up myself :)


> Well, shouldn't both of these be getting treated the same--either
> translated to HTML representation or not? That's what I would expect
> from reading the docs (Petal::Doc::Petales).

It is not legal XML to have '<' in a text section.
However it is legal to have '>' in a text section.

'>' cannot be encoded because of inline CSS selectors, i.e.

<style>
  body>foo {
    ... some css ...
  };
</style>


Your example causes a problem because of Javascript...

Let's face it, both inline CSS and inline JavaScript are pretty ugly.
However I think that JavaScript is orders of magnitude more ugly than
inline CSS...

I don't think I'll change Petal's behavior for that.

What you might want to do is export all your javascript functions in a
'.js' file which you can import, and then use only simple javascript
function calls inside your HTML file...

<zealot>Or you could avoid using JavaScript :)</zealot>


That being said I realize that I don't really have a solution to your
problem... can anyone think of anything? 


I'll try to dig this out a little bit more!
Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/



More information about the Petal mailing list