xsd-to-dita_xs__import.xsl 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:xsd-to-dita="xsd-to-dita.xsd"
  5. exclude-result-prefixes="xs xsd-to-dita "
  6. version="2.0">
  7. <!--<xsl:variable name="xsd-to-dita:master.xsd" select="'xsd-to-dita_master.xsd'"/>-->
  8. <!--<xsl:output doctype-public="-//OASIS//DTD DITA Topic//EN"
  9. doctype-system="topic.dtd"/>-->
  10. <xsl:template mode="xsd-to-dita:master.xsd__import" match="xs:import">
  11. <!--<xsl:copy>
  12. <xsl:copy-of select="@*"/>
  13. </xsl:copy>-->
  14. <xsl:call-template name="xsd-to-dita:xs__import"/>
  15. </xsl:template>
  16. <xsl:template name="xsd-to-dita:xs__import">
  17. <xsl:message >
  18. <xsl:value-of select="$xsd-to-dita:out__dir"/>/<xsl:value-of select="tokenize(@schemaLocation,'/')[last()]"/><xsl:value-of select="last()"/>
  19. </xsl:message>
  20. <xsl:comment>#21A import</xsl:comment>
  21. <topicref href="{$xsd-to-dita:out__dir}/{tokenize(@schemaLocation,'/')[last()]}.dita"/>
  22. <xsl:result-document
  23. doctype-public="-//OASIS//DTD DITA Topic//EN"
  24. doctype-system="topic.dtd" href="{$xsd-to-dita:out__dir}/{tokenize(@schemaLocation,'/')[last()]}.dita">
  25. <xsl:apply-templates mode="xsd-to-dita:master.xsd__import" select="doc(@schemaLocation)">
  26. <xsl:with-param name="xsd-to-dita:dita_id" select="xsd-to-dita:dita_id(@schemaLocation)" tunnel="yes"/>
  27. </xsl:apply-templates>
  28. </xsl:result-document>
  29. </xsl:template>
  30. <xsl:template mode="xsd-to-dita:master.xsd__import" match="xs:schema[xs:annotation[xs:documentation]]">
  31. <xsl:param name="xsd-to-dita:dita_id" required="yes" tunnel="yes"/>
  32. <xsl:comment>#28AM xsd-to-dita:master.xsd__import match="*" [<xsl:value-of select="name()"/>]</xsl:comment>
  33. <topic id="{$xsd-to-dita:dita_id}">
  34. <title><xsl:value-of select="xs:annotation/xs:documentation"/></title>
  35. <body>
  36. <p>
  37. <xsl:apply-templates mode="xsd-to-dita:master.xsd__import" />
  38. </p>
  39. </body>
  40. </topic>
  41. </xsl:template>
  42. <!--<xsl:variable name="xsd-to-dita:master.xsd__import__schemaLocation"/>-->
  43. </xsl:stylesheet>