List Info

Thread: profiling and entities -




profiling and entities -
user name
2007-10-17 06:12:48
Hi All,

I'm trying to publish three very similar documents, from one
master.
One can do this with profiling,

<section os="win">
</section>
<section os="lin">
</section>

and then publishing once for each profile. But this gets
more
complicated if I want to use an entity, and reuse only one
lot of
text:

This works, but is a LOT of overhead

<section>
<para> sfdfssdf sdfsfsdf sdfdsfdsf  <phrase
os="lin">&MYENT_LINUX</phrase><phr
ase
os="win">&MYENT_WINDOWS</phrase></
para>
</section>

Is there someway to control entities with profiling

I could use

<section>
<para> sfdfssdf sdfsfsdf sdfdsfdsf  &MYOS;
</para>
</section>

but if you use many variables it is a pain to change them
each time,
and could induce errors.

Any thoughts on the best way to do this?

Thanks
Sam,

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: profiling and entities -
user name
2007-10-17 11:02:41
Yes, there is an easier way, but it requires some
coordination at runtime. 
You can put your entity declarations into a central file
referenced by all 
your documents.  Then you can use an XML Catalog at runtime
to map the 
identifier to an entity collection file with the same names
but different 
text values, depending on which profile you are running. 
The coordination 
part is in selecting a different catalog at runtime to match
the profile 
you are running.

Here is some more info on this approach:

http://www.sagehill.net/docbookxsl/ModularEntities.html
http
://www.sagehill.net/docbookxsl/Catalogs.html

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Samuel Wright" <lykoszinegmail.com>
To: <docbook-appslists.oasis-open.org>
Sent: Wednesday, October 17, 2007 4:12 AM
Subject: [docbook-apps] profiling and entities -


> Hi All,
>
> I'm trying to publish three very similar documents,
from one master.
> One can do this with profiling,
>
> <section os="win">
> </section>
> <section os="lin">
> </section>
>
> and then publishing once for each profile. But this
gets more
> complicated if I want to use an entity, and reuse only
one lot of
> text:
>
> This works, but is a LOT of overhead
>
> <section>
> <para> sfdfssdf sdfsfsdf sdfdsfdsf  <phrase
>
os="lin">&MYENT_LINUX</phrase><phr
ase
>
os="win">&MYENT_WINDOWS</phrase></
para>
> </section>
>
> Is there someway to control entities with profiling
>
> I could use
>
> <section>
> <para> sfdfssdf sdfsfsdf sdfdsfdsf  &MYOS;
</para>
> </section>
>
> but if you use many variables it is a pain to change
them each time,
> and could induce errors.
>
> Any thoughts on the best way to do this?
>
> Thanks
> Sam,
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
>
>
> 



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: profiling and entities -
user name
2007-10-18 02:50:06
Samuel Wright wrote:

> Is there someway to control entities with profiling
> 
> I could use
> 
> <section>
> <para> sfdfssdf sdfsfsdf sdfdsfdsf  &MYOS;
</para>
> </section>

Yes, you can define MYOS as

<!ENTITY MYOS "<phrase
os="lin">linux
content</phrase><phrase
os="win">windows
content</phrase>">

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34
member
------------------------------------------------------------
------

Re: profiling and entities -
user name
2007-10-18 04:33:32
We have exactly the same requirement.

Unfortunately, we found that we couldn't use entities,
because  
XMLMind (our editor of choice) seems to permanently expand
them when  
opening a document, so opening something with &OS;
becomes "Linux"  
when the document is re-saved.

We have two ways to work around this:

1. We've added tags to DocBook - TargetOS, ProductName,  
ProductVersion, etc.  These tags can contain nothing (not
even any  
text), and we've modified the stylesheets to replace them
with text,  
based on parameters passed into the xsl preprocessor.

2. (This is the way that XMLMind recommends) is to use
xi:include:

<phrase id = "my_os_phrase">
   <phrase os =
"win">Windows</phrase>
   <phrase os =
"linux">Linux</phrase>
</phrase>

And then everywhere you want to mention the OS, just do:

<xi:include pointer="element(my_os_phrase)"
/>

(XML Mind wraps this up nicely with its "Copy As
Reference" capability)

If your processor is set up to follow xi:includes, or you
pre-process  
them out, this should also do what you want.
(I've not actually tried this, because I've not got things
set up for  
xi:include processing yet)

Thanks,

Geraint North
Principal Engineer
Transitive


On 17 Oct 2007, at 12:12, Samuel Wright wrote:

> Hi All,
>
> I'm trying to publish three very similar documents,
from one master.
> One can do this with profiling,
>
> <section os="win">
> </section>
> <section os="lin">
> </section>
>
> and then publishing once for each profile. But this
gets more
> complicated if I want to use an entity, and reuse only
one lot of
> text:
>
> This works, but is a LOT of overhead
>
> <section>
> <para> sfdfssdf sdfsfsdf sdfdsfdsf  <phrase
>
os="lin">&MYENT_LINUX</phrase><phr
ase
>
os="win">&MYENT_WINDOWS</phrase></
para>
> </section>
>
> Is there someway to control entities with profiling
>
> I could use
>
> <section>
> <para> sfdfssdf sdfsfsdf sdfdsfdsf  &MYOS;
</para>
> </section>
>
> but if you use many variables it is a pain to change
them each time,
> and could induce errors.
>
> Any thoughts on the best way to do this?
>
> Thanks
> Sam,
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis- 
> open.org
>


------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


RE: profiling and entities -
user name
2007-10-18 08:22:38
Avoiding entities is a good idea anyway. They're
inconvenient if you
need to process your source with xslt in a context other
than processing
to produce output (e.g. to pretty print it before checking
into a
repository or to make some global change to the source
files).

David

> -----Original Message-----
> From: Geraint North [mailto:gerainttransitive.com] 
> Sent: Thursday, October 18, 2007 4:34 AM
> To: Samuel Wright
> Cc: docbook-appslists.oasis-open.org
> Subject: Re: [docbook-apps] profiling and entities -
> 
> We have exactly the same requirement.
> 
> Unfortunately, we found that we couldn't use entities,

> because XMLMind (our editor of choice) seems to
permanently 
> expand them when opening a document, so opening
something 
> with &OS; becomes "Linux"  
> when the document is re-saved.
> 
> We have two ways to work around this:
> 
> 1. We've added tags to DocBook - TargetOS, ProductName,

> ProductVersion, etc.  These tags can contain nothing
(not 
> even any text), and we've modified the stylesheets to
replace 
> them with text, based on parameters passed into the xsl
preprocessor.
> 
> 2. (This is the way that XMLMind recommends) is to use
xi:include:
> 
> <phrase id = "my_os_phrase">
>    <phrase os =
"win">Windows</phrase>
>    <phrase os =
"linux">Linux</phrase>
> </phrase>
> 
> And then everywhere you want to mention the OS, just
do:
> 
> <xi:include
pointer="element(my_os_phrase)" />
> 
> (XML Mind wraps this up nicely with its "Copy As
Reference" 
> capability)
> 
> If your processor is set up to follow xi:includes, or
you 
> pre-process them out, this should also do what you
want.
> (I've not actually tried this, because I've not got
things 
> set up for xi:include processing yet)
> 
> Thanks,
> 
> Geraint North
> Principal Engineer
> Transitive
> 
> 
> On 17 Oct 2007, at 12:12, Samuel Wright wrote:
> 
> > Hi All,
> >
> > I'm trying to publish three very similar
documents, from one master.
> > One can do this with profiling,
> >
> > <section os="win">
> > </section>
> > <section os="lin">
> > </section>
> >
> > and then publishing once for each profile. But
this gets more 
> > complicated if I want to use an entity, and reuse
only one lot of
> > text:
> >
> > This works, but is a LOT of overhead
> >
> > <section>
> > <para> sfdfssdf sdfsfsdf sdfdsfdsf 
<phrase 
> >
os="lin">&MYENT_LINUX</phrase><phr
ase
> >
os="win">&MYENT_WINDOWS</phrase></
para>
> > </section>
> >
> > Is there someway to control entities with
profiling
> >
> > I could use
> >
> > <section>
> > <para> sfdfssdf sdfsfsdf sdfdsfdsf 
&MYOS; </para> </section>
> >
> > but if you use many variables it is a pain to
change them 
> each time, 
> > and could induce errors.
> >
> > Any thoughts on the best way to do this?
> >
> > Thanks
> > Sam,
> >
> > 
>
------------------------------------------------------------
---------
> > To unsubscribe, e-mail: 
> docbook-apps-unsubscribelists.oasis-open.org
> > For additional commands, e-mail:
docbook-apps-helplists.oasis- 
> > open.org
> >
> 
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
> For additional commands, e-mail: 
> docbook-apps-helplists.oasis-open.org
> 
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: profiling and entities -
user name
2007-10-19 07:54:38
Hi All,

Thanks for the responses. I'll address them individually
below.

Bob, that method sounds involved but doable. I link to a
central
entitfy file anyway, so as to be able to change entities
once only.

Jirka, at the price of killing readability that would work.
Nasty if
you are doing it often though.

Geraint, I think that behaviour occurs in all wysi(sort
of)wyg
editors, and is one reason why I did not use XMLMind. The
xinclude
method looks pretty bad in terms of extra typing.

Regarding your custom tags, would it not better to have
something like

<tag id="TargetOS" /> <tag
id="TargetHW" /> instead of <TargetOS
/>,
<TargetHW />, adding only a single tag rather than
lots.

Hmm, I miight look into this further.

David. How do you single source without using entities?
Using only profiles?
Is it hard to resolve entities without doing any other xslt
processing? I image you could do this with xsltproc or
something, but
admittedly have not checked.

If you have any further thoughts on this I'd love to hear
them. While
we are at it, how many people single soure docbook in one
way or
another? Do people just use profiles? Any tips? Pitfalls?

Thanks
S

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: profiling and entities -
user name
2007-10-19 08:40:37
Hi Samuel,

Geraint North wrote:
 > Unfortunately, we found that we couldn't use entities,
because XMLMind
 > (our editor of choice) seems to permanently expand
them when opening a
 > document, so opening something with &OS; becomes
"Linux" when the
 > document is re-saved.

Samuel Wright wrote:
> [...]
> Geraint, I think that behaviour occurs in all wysi(sort
of)wyg
> editors, and is one reason why I did not use XMLMind. 

We made available a new beta build of oXygen 9. This handles
entities in 
attribute values correctly, leaving them as they were when
switching to 
Author mode (WYSIWYG-like editing).
All you need to get started in a few minutes including an
updated 
license key (no registration required) with oXygen 9 beta 2
is here:

http://ww
w.oxygenxml.com/download-beta.html

Best Regards,
George
------------------------------------------------------------
---------
George Cristian Bina - http://aboutxml.blogspo
t.com/
<oXygen/> XML Editor, Schema Editor and XSLT
Editor/Debugger
http://www.oxygenxml.com





------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: profiling and entities -
user name
2007-10-19 08:19:57
> Geraint, I think that behaviour occurs in all wysi(sort
of)wyg
> editors, and is one reason why I did not use XMLMind.
The xinclude
> method looks pretty bad in terms of extra typing.
>
> Regarding your custom tags, would it not better to have
something like
>
> <tag id="TargetOS" /> <tag
id="TargetHW" /> instead of <TargetOS
/>,
> <TargetHW />, adding only a single tag rather
than lots.
>
> Hmm, I miight look into this further.

Sam,

I guess they both come down to whether or not you're using a
GUI.  In  
XMLMind, the extra typing required doesn't matter, and
having  
explicit tags means that they appear on the drop-down list
of  
available elements, which would be less intuitive if we had
a generic  
tag, because the user would have to remember what the
available  
options were.  I agree that were we typing the XML by hand,
a generic  
tag element with attributes would make more sense.

Thanks,
Geraint.

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )