Subject: Re: specific XSL file for certain pages instead of netbsd-website.xsl for everything
To: None <netbsd-docs@NetBSD.org>
From: Klaus Heinz <k.heinz.maer.fuenf@onlinehome.de>
List: netbsd-docs
Date: 03/21/2005 01:56:38
--1SQmhf2mF2YjsYvc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Klaus Heinz wrote:
> Patch is appended to this message.
Update. The generated files are now added to GENDOCS, so "make" or "make
clean" should work as well.
ciao
Klaus
--1SQmhf2mF2YjsYvc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="web.site.mk.diff"
Index: web.site.mk
===================================================================
RCS file: /cvsroot/htdocs/share/mk/web.site.mk,v
retrieving revision 1.30
diff -u -r1.30 web.site.mk
--- web.site.mk 15 Mar 2005 22:55:17 -0000 1.30
+++ web.site.mk 20 Mar 2005 23:59:26 -0000
@@ -137,6 +137,46 @@
@${ECHO} "[html2txt] ${.IMPSRC} -> ${.TARGET}"
@${HTML2TXT} ${HTML2TXTOPTS} ${.IMPSRC} > ${.TARGET}
+###### Enable non-default stylesheets for transformation of XML documents
+#
+# DOCSXSL_TARGETS: list of documents which will be generated by a
+# non-default stylesheet
+# DOCSXSL_SRC.${target}: the XML source file for a single $target
+# DOCSXSL_STYLESHEET.${target}: path to the stylesheet for $target
+# DOCSXSL_XMLDEPS.${target}: additional prerequisites for $target.
+# DOCSXSL_SRC.${target} and
+# DOCSXSL_STYLESHEET.${target} are automatically
+# added to this list.
+# Don't forget to add any stylesheets here if
+# you import/include them in DOCSXSL_STYLESHEET.*
+#
+# Example:
+# DOCSXSL_TARGETS= news.html
+# DOCSXSL_SRC.news.html= news.xml
+# DOCSXSL_STYLESHEET.news.html= ${WEB_PREFIX}/share/xsl/newspage.xsl
+# DOCSXSL_XMLDEPS.news.html= ${WEB_PREFIX}/share/xsl/months-${DOCLANG}.xsl
+#
+.if defined(DOCSXSL_TARGETS) && !empty(DOCSXSL_TARGETS)
+GENDOCS+= ${DOCSXSL_TARGETS}
+. for _target in ${DOCSXSL_TARGETS}
+. if !defined(DOCSXSL_SRC.${_target}) || empty(DOCSXSL_SRC.${_target})
+${_target}:
+ @${ECHO} "No XML source file specified for ${_target}"
+. elif !defined(DOCSXSL_STYLESHEET.${_target}) || empty(DOCSXSL_STYLESHEET.${_target})
+${_target}:
+ @${ECHO} "No stylesheet specified for ${_target}"
+. else
+# the XML source file and the stylesheet are prerequisites
+DOCSXSL_XMLDEPS.${_target}+= ${DOCSXSL_SRC.${_target}} \
+ ${DOCSXSL_STYLESHEET.${_target}}
+
+${_target}: ${DOCSXSL_XMLDEPS.${_target}}
+ @${ECHO} "[xsltproc] '${DOCSXSL_SRC.${_target}}' -> ${.TARGET}"
+ @(ulimit -d 500001 && ${XSLTPROC} -o ${.TARGET} ${DOCSXSL_STYLESHEET.${_target}} ${DOCSXSL_SRC.${_target}})
+. endif
+. endfor
+.endif
+
###
# file.list --> file.html
#
--1SQmhf2mF2YjsYvc--