Makefile.docParam 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # $Source$
  2. # $Author: xmldoc $
  3. # $Date: 2007-03-23 21:57:22 +0000 (Fri, 23 Mar 2007) $
  4. # $Revision: 6759 $
  5. # vim: number
  6. #
  7. # ------------------------------------------------------------------
  8. # ** Makefile.paramDoc - create param.xsl files w/ embedded doc **
  9. # ------------------------------------------------------------------
  10. PARAMFILES = $(wildcard ../../*/param.xsl)
  11. PARAMFILESDOCD = $(foreach base,$(basename $(PARAMFILES)),$(base).docd.xsl)
  12. XSLT=xsltproc
  13. XSLTFLAGS=
  14. COPYDOC := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
  15. xmlns:doc="http://docbook.org/ns/docbook" \
  16. version="1.0"> \
  17. <xsl:template match="*[local-name() = &apos;param&apos;]"> \
  18. <xsl:call-template name="copy-xsl-source"/> \
  19. </xsl:template> \
  20. <xsl:template match="*[local-name() = &apos;attribute-set&apos;]"> \
  21. <xsl:call-template name="copy-xsl-source"/> \
  22. </xsl:template> \
  23. <xsl:template name="copy-xsl-source"> \
  24. <xsl:variable \
  25. name="source" \
  26. select="concat(&apos;../../params/&apos;,@name,&apos;.xml&apos;)"/> \
  27. <xsl:apply-templates select="document($$source)/*[local-name() = &apos;refentry&apos;]"/> \
  28. <xsl:copy> \
  29. <xsl:apply-templates select="@* | node()"/> \
  30. </xsl:copy> \
  31. </xsl:template> \
  32. <xsl:template match="node() | @*"> \
  33. <xsl:copy> \
  34. <xsl:apply-templates select="@* | node()"/> \
  35. </xsl:copy> \
  36. </xsl:template> \
  37. <xsl:template match="*[local-name() = &apos;refentry&apos;]"> \
  38. <xsl:text>&\#x0a;</xsl:text> \
  39. <doc:refentry id="{@*[local-name() = &apos;id&apos;]}"> \
  40. <xsl:apply-templates/> \
  41. </doc:refentry> \
  42. <xsl:text>&\#x0a;</xsl:text> \
  43. </xsl:template> \
  44. <xsl:template match="*[local-name() = &apos;refsynopsisdiv&apos;]"/> \
  45. </xsl:stylesheet>
  46. all: $(PARAMFILESDOCD)
  47. %.docd.xsl: %.xsl
  48. @echo '$(COPYDOC)' | $(XSLT) $(XSLTFLAGS) - $< > $@
  49. debug:
  50. @echo $(PARAMFILESDOCD)
  51. clean:
  52. $(RM) $(PARAMFILESDOCD)