On Wednesday, December 17, 2003, at 03:20  AM, Hussein Shafie wrote:

> Steve Sarette wrote:
>> Hello.
>> 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>
>> and then use XInclude to include the appropriate phrase where 
>> necessary in the text body. By reading the product doc and by playing 
>> around with the free version of XMLMind, it certainly seems like this 
>> should work. However, I'm reluctant to gamble a few hundred dollars 
>> only to find out that it doesn't.
>> Also, I need to know if this sort of thing will work with the PDF and 
>> RTF conversion plug-ins that are available for XmlMind.
>
> I tested this with:
>
> ---
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE para PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
>   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>
> <para>
>   <phrase id="myprod">My New Product Name</phrase>
>   <phrase id="otherprod">My Other Product Name</phrase>
> </para>
> ---
>
> Note that you need to add a DTD to make XXE recognize id as being an 
> ID attribute.
>
> Everything works fine with the Professional Edition, including 
> conversion to RTF and PDF.
>
> I created this:
>
> ---
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
> "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>
> <article>
>   <title>Test</title>
>
>   <sect1>
>     <title>Test</title>
>
>     <para>First product <xi:include
> href="phrases.xml#myprod"
> xmlns:xi="http://www.w3.org/2001/XInclude";
> ></xi:include
> >.</para>
>
>     <para>Second product <xi:include
> href="phrases.xml#otherprod"
> xmlns:xi="http://www.w3.org/2001/XInclude";
> ></xi:include
> >.</para>
>   </sect1>
> </article>
> ---
>
> I just have to warn you that the GUI is a bit tedious to use when you 
> repeatedly insert references to different elements found inside the 
> same external document. (For example, there is no keyboard shortcut to 
> insert a reference to an external document or element.)

In theory, you should be able to have both of these in the same 
document:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>
<article>
   <phrase id="myprod">My New Product Name</phrase>
   <phrase id="otherprod">My Other Product Name</phrase>
   <title>Test</title>

   <sect1>
     <title>Test</title>

     <para>First product <xi:include href="#myprod" 
xmlns:xi="http://www.w3.org/2001/XInclude"/>.</para>

     <para>Second product <xi:include href="#otherprod" 
xmlns:xi="http://www.w3.org/2001/XInclude"/>.</para>
   </sect1>
</article>

I was not able to make this work.  If I load the above into XML mind it 
complains
about an inclusion loop--which doesn't exist as the targets of the 
inclusion
is *not* an ancestor.

I also checked with a colleague of mine on the XML Core WG about this 
and it is
correct that this example should work.

Alex Milowski                FAX: (707) 598-7649                        
  alex at milowski.com

"The excellence of grammar as a guide is proportional to the paucity of 
the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics



Reply via email to