[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Website: Problem using olinks across websites
Following Bob's lead, I've tried to generate a website.database.xml that
does not contain the offending document elements - with no luck.
To simplify things, I built the example website that comes with the
website 2.6 distribution, using the layout and build.xml ant file
provided. Other than pointing at local resources, I only modified it by
adding the last argument to this target:
==============================================
<target name="doWebsite">
<java classname="${xslt.processor.class}"
fork="yes"
dir="${in.dir}"
failonerror="true">
<classpath refid="xslt.processor.classpath" />
<arg line="-o ${out.dir}/${website.outfile}"/>
<arg line="-x org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<arg line="-y org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<arg line="-r org.apache.xml.resolver.tools.CatalogResolver"/>
<arg line="${in.dir}/${autolayout.outfile}"/>
<arg line="${website.stylesheet}"/> <!-- tried both
chunk-tabular and chunk-website)
<arg line="${param.args.post}"/>
<arg line="collect.xref.targets='yes'" />
</java>
</target>
==============================================
This generates the website.database.xml file, but the file contains
document elements for each webpage, like this:
==============================================
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<targetset>
<document targetdoc="home" baseuri="index.html" dir="out/">
<div element="webpage" href="#home" number="" targetptr="home">
...
</document>
<document targetdoc="layout" baseuri="layout.html" dir="out/">
...
</document>
</targetset>
==============================================
This structure obviously can't be included in a site map, as Bob points
out. I'm not sure (not having seen a correct example yet!) but I imagine
it should look more like the standard DocBook olink database, where a
book and its chapters are represented by nested divs, not document
elements.
I suppose I could postprocess the website.database.xml files to get what
I want, but that would be cheating.
P.S. Just in case Silkpage could give me a clue, I installed it and
generated a website.database.xml there. Learned nothing new: the file
has the same structure.
Denis Bradford wrote:
> Sorry, I should have indicated that the first bit was a fragment - I do
> have a sitemap element.
>
> I'm confused about your second point: I understand that nested document
> elements are a problem. But my generated website.database.xml file
> always has a document element. In fact, it has one for each webpage in
> my layout. Sounds like I'm really missing a point here here.
>
> I'll go back to the sample
>
>
>
> Bob Stayton wrote:
>> Hi Denis,
>> A couple of items may fix this:
>>
>>> <targetset>
>>> <dir name="build">
>>> <document targetdoc="homeSite">
>>> <xi:include href="website.database.xml" />
>>> </document>
>>> <dir name="schedule">
>>> <document targetdoc="scheduleSite">
>>> <xi:include href="schedule/website.database.xml" />
>>> </document>
>>> </dir>
>>
>> It seems you are missing a sitemap element in your olinkdatabase.
>>
>>> 3. Finally, the olinks themselves. I've tried a couple of forms. For
>>> example, here's an olink to a homeSite page from within a
>>> scheduleSite page:
>>>
>>> <olink targetdoc="about" targetptr="about"/>
>>> <olink targetdoc="homeSite" targetptr="about"/>
>>>
>>> The first is the recommended form where 'about' is the id of the
>>> webpage. It does not resolve at all. The second is the conventional
>>> (non-website) form, but seems doomed because there is no book or any
>>> document with the id "homeSite". Encouragingly, it finds the title -
>>> but alas, the wrong url:
>>>
>>> <a href="../#about" class="olink">About this site</a>
>>
>> The first is recommended when referencing a page within a single
>> website. The second is for referencing outside of website to another
>> document (in this case, another website). The targetdoc values are an
>> olink feature that exists outside of any document id attributes. All
>> that needs to match is a targetdoc value in an olink to a targetdoc
>> value in a <document> element in a database.
>>
>> The second example is correct and does find the data, as you noticed,
>> but gives the wrong URI. I think adding the sitemap should fix the
>> path problem.
>>
>> One thing I'm not clear about is your website.database.xml file. It
>> seems to have a document element with targetdoc attribute. But then
>> you put that inside another document element with different targetdoc
>> in olinkdatabase. The document element should not be nested. Normally
>> the target data for a document generated by the stylesheet does not
>> have a document element.
>>
>> Bob Stayton
>> Sagehill Enterprises
>> bobs@sagehill.net
>>
>>
>> ----- Original Message ----- From: "Denis Bradford"
>> <denis.bradford@verizon.net>
>> To: <docbook-apps@lists.oasis-open.org>
>> Sent: Monday, March 31, 2008 8:29 PM
>> Subject: [docbook-apps] Website: Problem using olinks across websites
>>
>>
>>> I maintain a web site as a collection of DocBook websites, each with
>>> its own layout and its own TOC. I want to replace the old ulinks with
>>> olinks. The olinks are working fine within each website, but olinks
>>> across websites fail to resolve. Here's how TDG says to do it:
>>>
>>> "Once you have the targets database, you can pass its pathname to the
>>> XSLT processor using the target.database.document stylesheet
>>> parameter. This database is in addition to (and separate from) the
>>> olink database that resolves olinks between webpages in your website.
>>> The database of internal olinks is identified with the
>>> website.database.document parameter. When the processor encounters an
>>> olink, it first checks the website database before consulting the
>>> offsite database."
>>>
>>> All right, here's how I've been trying to implement it:
>>>
>>> 1. In my ant script, after building the layouts, I transform each
>>> website in turn. In addition to setting collect.xref.targets='yes'
>>> and declaring the current docid, I specify both the website.database
>>> and target.database documents, like this:
>>>
>>> <target name="doWebsite.home">
>>> <java ...
>>> <arg line="collect.xref.targets='yes'" />
>>> <arg line="current.docid='homeSite'" />
>>> <arg line="target.database.document='olinksitemap'"/>
>>> <arg line="website.database.document='website.database.xml'" />
>>> </java>
>>> </target>
>>>
>>> It seems the
>>>
>>> 2. Meanwhile, I've created olinksitemap by hand. It includes the
>>> website.database.document for each website, like this:
>>>
>>> <targetset>
>>> <dir name="build">
>>> <document targetdoc="homeSite">
>>> <xi:include href="website.database.xml" />
>>> </document>
>>> <dir name="schedule">
>>> <document targetdoc="scheduleSite">
>>> <xi:include href="schedule/website.database.xml" />
>>> </document>
>>> </dir>
>>> ...
>>> </targetset>
>>>
>>> 3. Finally, the olinks themselves. I've tried a couple of forms. For
>>> example, here's an olink to a homeSite page from within a
>>> scheduleSite page:
>>>
>>> <olink targetdoc="about" targetptr="about"/>
>>> <olink targetdoc="homeSite" targetptr="about"/>
>>>
>>> The first is the recommended form where 'about' is the id of the
>>> webpage. It does not resolve at all. The second is the conventional
>>> (non-website) form, but seems doomed because there is no book or any
>>> document with the id "homeSite". Encouragingly, it finds the title -
>>> but alas, the wrong url:
>>>
>>> <a href="../#about" class="olink">About this site</a>
>>>
>>> fwiw, here's the corresponding code in the website database:
>>>
>>> <document targetdoc="about" baseuri="about.html">
>>> <div element="webpage" href="#about" number=""
>>> targetptr="about" lang="en">
>>> <ttl>About this site</ttl>
>>>
>>>
>>> Am I anywhere near the right track, or completely off? Any working
>>> examples of cross-website olinks?
>>>
>>> TIA,
>>> Denis
>>
>
>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]