Steve Sarette wrote:
> I'm thinking about purchasing XML Mind profession edition, but before I 
> do I want to make sure about something. I have an absolute requirement 
> to be able to  "variablize" product names. Normally I would just use 
> shared text entities for this (e.g. <!ENTITY myprod "My New Product 
> Name> but XmlMind replaces these on import.
> 
> So I'm wondering if I can achieve the same effect using XInclude. What I 
> would want to do is have a file with all my variables in it, and 
> identify each with an id tag. For example:
> 
> <para><phrase id="myprod">My New Product Name</phrase><phrase 
> id="otherprod">My Other Product Name</phrase>

Hussein Shafie will surely answer this more definitively, but I don't 
believe you can define text entities outside of the DTD or the internal 
subset of the DOCTYPE declaration.  So you can't use XInclude to do this.

However, we use XXE and we have similar requirements to parameterize 
product names (for which we use text entities defined in DTDs and/or 
internal subsets).  I've developed a perl script that will "unexpand" 
general entities that XXE has expanded, and we use it to address this 
problem.

Now that XXE can "manage" external entities, the limitations of this 
script w.r.t. chapter inclusion, etc. are much less of an issue, and it 
does a good job on the smaller entities used for product names, etc. as 
long as they are distinct from normal text.  For example, if you have a 
product named "ant", and define an entity <!ENTITY "product" "ant">, 
then all instances of "ant" as a whole word (including the "ant" in 
"ant-eater") would be replaced with &product; after running through the 
perl script.  With product names that are CapitAlized or wrapped in 
<trademark> any sort of mistake is quite rare.

The proper way to implement this is with custom Java code that performs 
the same sort of substitutions on the text; this could be completely 
integrated with XXE, using the save-hook functionality (which didn't 
exist when I wrote the perl script).  I have not had time to do this 
(yet? ever?) but for a competent Java programmer, it would not be more 
than a few days work.  (I could maybe be convinced to do this in 
exchange for an XXE Professional license :-)

I would encourage you to seriously consider using XXE; it is one of the 
best XML editors around, and keeps getting better.  In combination with 
the unxxe.pl script, we have found it to work quite well.  If you have 
problems with the unxxe.pl perl script, I will attempt to help you with 
them (but note that it comes with no guarantees or warrantee (or 
copyright) of any sort.

@alex
-- 
mailto:dupuy at sysd.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: unxxe.pl
Url: 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20031218/6eb0717d/attachment.bat
 

Reply via email to