On 2017-04-10 David Kendal wrote:
> On 2017-04-09 Jan Tosovsky wrote:
> > On 2017-04-09 David Kendal wrote:
> >
> > > ... there are many possible uses for local static files accessing
> > > other local static files: the one I have in mind is shipping static
> > > files on CD-ROM or USB stick...
> >
> > In this case the file structure is fixed so it can be exported as
> > JSON file and then linked via the HTML header in every HTML file where 
> > it is needed. This structure is then directly available for the further
> > processing.
> >
> > However, I am not sure this covers your use case.
> 
> I'm not sure either, because I don't understand what you're proposing.
> What feature of the HTML header enables this functionality? (For an
> arbitrary number of files which may be wanted by an arbitrary number
> of other files, and which could be very large.)

Imagine e.g. WebHelp composed of collection of static files with Table of 
Contents (ToC) in the left pane. It is not very efficient to generate large ToC 
into every single HTML file. If you extract ToC into a dedicated HTML page, it 
cannot be imported by standard means directly into another HTML page 
(analogically to XML Inclusions [1]). You have to use either IFrame, or, 
better, provide ToC as JSON file. JSON is kind of javascript which can be 
linked via the <script> tag in the HTML header. It is hence loaded together 
with the page and you can manipulate it further with javascript. In case of ToC 
to render data as itemized list with proper CSS classes and even detect if the 
current item matches the actual page (if so use a different class).

So basically you need
(1) JSON
(2) link to that JSON in your HTML file
(3) JavaScript in your HTML file, which renders JSON data to the page

In my case both WebHelp pages and JSON is generated via XSLT from XML source.

If you have to list the file structure of CD-ROM, I suppose it is fixed so it 
doesn't need to be determined dynamically, but in advance. I can imagine simple 
Java 'walker'[2] which could traverse all the folder content and export all 
necessary data into JSON structure.

Jan


_____________
[1] https://www.w3.org/TR/xinclude/
[2] https://docs.oracle.com/javase/tutorial/essential/io/walk.html


Reply via email to