This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] How to embed XML transforms into Docbook


There is no native mechanism in XML to apply XSLT transformations to an
entity.  After all, XSLT did not exist when XML 1.0 was created.

But the SYSTEM identifier in an entity declaration can be a URI.  The URI
could be a request to an HTTP server, which runs a CGI process to transform
the non-DocBook data into DocBook elements and returns those elements.  From
the point of view of the XML parser handling the DocBook document, all it
sees is DocBook content.  Of course, part of the content is dependent on
that CGI process running.  You could set up Cocoon to handle the server-side
processing, and it would cache the result to speed up subsequent processing.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Jim Kring" <jkring@jameskring.com>
To: <davep@dpawson.co.uk>
Cc: "'Docbook-Apps'" <docbook-apps@lists.oasis-open.org>
Sent: Sunday, January 02, 2005 6:00 AM
Subject: RE: [docbook-apps] How to embed XML transforms into Docbook


> Dave,
>
> Dave Pawson wrote:
> >
> > On Sat, 2005-01-01 at 14:57 -0800, Jim Kring wrote:
> > > Hello,
> > >
> > > I am fairly new to Docbook and XML, so thanks for your
> > patience.  I have
> > > what is probably a trivial question:
> > >
> > > How can I embed XML content into a Docbook from an XML file
> > that contains
> > > non-Docbook entities?
> > What do you mean by entity? An external XML instance, or character
> > entities?
> > (Assume former from later comments)
>
> Yes, I mean an external XML instance.  Such as, the following:
>
> <!ENTITY DBFile1 SYSTEM "DBFile1.xml">
>
> >
> > >
> > > I have created an XSL file that defines a transform of the
> > > XML file's content into a valid Docbook entity.
> >
> > Why not run that first, then include them as docbook content?
> >
>
> Yes, that is an option.  But I am trying to avoid that processing step.  I
> am getting my feet wet with Docbook (and XML) and I am using the WYSIWYG
XML
> Editor from XMLmind running in Windows.  My build process for transforming
> to HTML/PDF is quite manual (invoking the Transform function of XMLmind).
>
> > > Can I use an ENTITY declaration (or
> > > another mechanism) in my Docbook file that would embed the
> > > transformed content of the XML file by referencing the XML
> > > and the XSL file? I would like to do this dynamically,
> > > without having to create a file containing the transformed
> > > XML.
> >
> > OK, I don't follow the logic of that, unless its re-use, but
> > if that's the need;
> > nonDBFile1.xml
> > xslt takes it to DBFile1.xml
>
> Well, what I was hoping to find is some mechanism like the following,
which
> would allow me to perform the transform on the fly (without actually
> creating DBFile1, on disk):
>
> <!ENTITY DBFile1 SYSTEM "nonDBFile1.xml" TRANSFORMEDBY "nonDBtoDB.xslt">
>
> I know that the above is not correct usage of the ENTITY declaration, I am
> just trying to give an idea of a theoretical solution.
>
> >
> > simply include the latter, then as part of your processing chain
> > generate it prior to processing as docbook.
> >
>
> I agree that this is a good solution.  But, at the moment my processing
> chain is manual due to my lack of automated command-line tools (again, I
am
> using a WYSIWYG editor and Transform tool in Windows).
>
> >
> > >
> > > The only examples I could find of dynamic transformation of
> > > XML, were transforms to XHTML by a web browser by adding a
> > > stylesheet reference in the XML file, itself.  In my case,
> > > the XML file does not "know" that it is going to be
> > > transformed into a Docbook entity; but rather, the Docbook
> > > knows that it wants to transform an XML file into a Docbook
> > > entity using a stylesheet.
> >
> > Your logic escapes me Jim,
> > HTH,
> >
>
> What I was trying to say, is that nonDBFile1.xml has no knowledge of the
> fact that it is going to be transformed to DBFile1.xml, for use in a
> docbook.  So, if there was a possible solution, by declaring the (xslt)
> stylesheet inside of nonDBFile1.xml, this was not a preferred solution.  I
> was hoping to find a way to declare, inside the main docbook.xml file,
that
> there was an external xml instance which is the product of a transform of
> nonDBFile1.xml by nonDBtoDB.xslt.
>
> Thanks and Regards,
>
> -Jim
>
>
>
>



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]