At 05:33 PM 09/21/2000 +0000, L Commons wrote:
>We are developing an application which uses xml templates to control
>processing of a back end system, which produces text output, which may or
>may not be an xml document. In some cases the original template contains
>html tags, because the output will be an html page.
When you refer to "xml templates" and "the original template," do you mean
XSLT template rules?
>For the most part this works well, but we've run into a problem when we want
>to use one of our xml tags to specify the attribute of an html tag:
> <INPUT NAME="<custom_xml_tag />" TYPE="checkbox">
If you are in fact working with XSLT, you may be able to get around the
problem by setting up an XSLT variable which can be plugged into the value
of the NAME atribute. E.g.:
<!-- Insert calculation and/or literal value to be used -->
<!-- Here's where the NAME attribute is set up. -->
>Or back end process will look up or calculate some value to insert in place
>of <custom_xml_tag />. Unfortunately, we are unable to parse the original
>document because we can't have a '<' in the attribute value of the html tag.
>Can't we tell the parser (Xerces) to ignore the html tags (not treat them as
>xml, since they're not in the DTD)? Any other suggestions?
I don't know Xerces, but I seriously doubt that you can tell it to ignore
markup in an attribute value -- markup, per XML 1.0, can't be placed in an
attribute value. The fact that you're talking about
attribute-values-that-just-happen-to-be-HTML doesn't change that.
As someone else said, you can use character entity references in place of
the markup characters. You could also enclose the whole thing in a CDATA
section and just use the literal < and >.
Of course I don't know the details of your app, but I'd start with
questioning whether you really, absolutely must have *tags* as attribute
values. It's kind of perverse and probably bound to cause you trouble, like
trying to fend off a mugger with "Mace"-the-word instead of Mace-the-product.
John E. Simpson | "If you were going to
http://www.flixml.org | shoot a mime, would you use
XML Q&A: http://www.xml.com | a silencer?" (Steven Wright)