[Bese-devel] yaclml: TAL and namespaces without packages

Daniel White daniel at whitehouse.id.au
Tue Sep 8 05:27:34 UTC 2009


The current problem is that TAL requires all XML namespaces to have an
associated package.  In my case, I have a fairly sizeable template with
a lot of tags and attributes and I don't particularly want to hand
generate tags for then entire template.

I've attached a preliminary patch, but it needs some more work yet.

The basic approach the patch takes is to:

* Signal a namespace error only when the XML namespace is not properly
  declared.  An associated package is not required.

* Namespace declarations that are unresolvable are left as attributes.

* Only replace the tag name with a symbol if the namespace is
  resolvable.

* Only make a keyword from an attribute if it is qualified by a
  namespace (e.g. tal:replace) or its tag has a package associated with
  its namespace.  This is done for case sensitivity reasons.

* Generates an arbitrary tag (in TRANSFORM-LXML-FORM) if the name is a
  string.

I'm not sure whether the change makes the parser logic much more
complicated.  Two options here:

* Move all logic for mapping tags/attributes to symbol to a separate
  pass when the parser is completed.

* Similar to above, but replace the entire parser with CXML or XMLS.

The other issue is when transforming the lxml into yaclml tags there
doesn't seem to be an easy way to generate arbitrary tags that are
constant folded at compile-time by yaclml.  At present, I've defined a
custom tag that allows the name to be specified.  For example,

(<TAG :NAME "abc:Xyz") => <abc:Xyz></abc:Xyz>

WRAP-IN-TAG is about the closest to what is needed, but it
automatically downcases the tag name and isn't folded at compile time
by yaclml.

Also missing at the moment is the ability to enable or disable all of
this, as I imagine it should be disabled by default for both backwards
compatibility and keeping the stricter parser for the general case.

Thoughts, suggestions?

-- 
Daniel White
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tal-namespaces.patch
Type: text/x-patch
Size: 9746 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/bese-devel/attachments/20090908/aa321c75/attachment.bin>


More information about the bese-devel mailing list