質問

I've converted a bunch of old school presentation files to Docbook XML, and each file appears as expected. I intend to convert them to XHTML/HTML , and my test conversions look great. My only question is how to create a proper directory structure with links, I'm just not sure what process to consider. For example ... I'm looking to have links, to other converted Docbook pages, on the footers of the pages. If anyone has an idea to consider, I would appreciate the input.

Additionally with regards to XSLT, I'm using xsltproc which only supports XSLT 1.0 + common EXSLT modules. xsltproc is the command-line interface of libxslt, which still does not support XSLT 2.0. Regardless even though specific examples are great, I really need to know the general approach. With that information I could search further, to eventually locate specific examples.

役に立ちましたか?

解決

Given this source XML document:

<ref>
    <refentrytitle>FILE</refentrytitle>
    <volnum>1</volnum>
</ref>

then the this transformation:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:variable name="vU" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
 <xsl:variable name="vL" select="'abcdefghijklmnopqrstuvwxyz'"/>

 <xsl:template match="ref">
   <a href="/{volnum}/{translate(refentrytitle, $vU, $vL)}.xml">
     <xsl:value-of select="refentrytitle"/>
   </a>
 </xsl:template>
</xsl:stylesheet>

produces the wanted, correct result:

<a href="/1/file.xml">FILE</a>

他のヒント

Well with XSLT 2.0 as supported by processors like Saxon 9, XmlPrime or AltovaXML you can create several result documents with one stylesheet, using xsl:result-document http://www.w3.org/TR/xslt20/#creating-result-trees. Usually you use modes http://www.w3.org/TR/xslt20/#modes to process input nodes twice or even more times, with one mode you create the individual pages, with a second mode the toc.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top