forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Decent anchor links (Re: cvs commit: xml-forrest/src/resources/skins/common/xslt/html document2html.xsl)
Date Sun, 12 Jan 2003 10:25:44 GMT
On Sun, Jan 12, 2003 at 09:36:39AM +0100, Steven Noels wrote:
> Jeff Turner wrote:
> 
> >>There's a twisted little 'rightness' behind this xPointer idea, though - 
> >>it works for any element in the document, and strangely enough, there 
> >>is something I read somewhere which states that the high-level 
> >>_structure_ of documents don't change that much.
> >
> >
> >Yes, but it mixes concerns, because the address is for the content, which
> >the presentation theoretically shouldn't expose.
> 
> Yes, but that presentation (markup/structure) might change dramatically 
> by just applying a different skin, so I thought using the source 
> structure would be more future-proof.
> 
> >>For your transformer, 
> >>don't forget to think about:
> >>
> >><section>
> >> <title>Introduction</title>
> >> <p>foobar</p>
> >> <section>
> >>   <title>Operational constraints</title>
> >>   <section>
> >>     <title>Introduction</title>
> >>   </
> >> </
> >></
> >
> >
> >It's all done with XPath:
> >
> ><map:transform type="idgen">
> >  <map:parameter name="element" value="/document/body//*[local-name() = 
> >  'section']"/>
> >  <map:parameter name="id" value="*[1]/text()"/>
> ></map:transform>
> 
> Yep. Expensive XPath operation, though?

Expensive DOM creation, mostly.  I wish someone would write a
STXTransformer so one could do XPath-like stuff with SAX.

> I assume the id-value is 
> composed of the text() content of the first child-element of the matched 
> section element, i.e. title (since that is required in the DTD).

I wanted to make it fairly generic, so that we can use the same
transformer to augment FAQ, doc-v11, Docbook etc.  Without this
requirement I could probably have gotten away with straight SAX too.

> So that wouldn't solve the problem of multiple sections with the same 
> title in one document, I guess?

Well not until this email :)  I just modified it to make IDs unique, by
appending generate-id().


--Jeff

> </Steven>
> -- 
> Steven Noels                            http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at            http://blogs.cocoondev.org/stevenn/
> stevenn at outerthought.org                stevenn at apache.org
> 

Mime
View raw message