hholzgra Mon Nov 12 10:00:45 2001 EDT
Modified files: (Branch: dev_docbook4)
/phpdoc dbk4_upgrade.xsl
Log:
comments added
whitespace handling for comments fixed
Index: phpdoc/dbk4_upgrade.xsl
diff -u phpdoc/dbk4_upgrade.xsl:1.1.2.1 phpdoc/dbk4_upgrade.xsl:1.1.2.2
--- phpdoc/dbk4_upgrade.xsl:1.1.2.1 Sun Nov 11 20:55:35 2001
+++ phpdoc/dbk4_upgrade.xsl Mon Nov 12 10:00:45 2001
@@ -7,6 +7,7 @@
<xsl:output method="xml" />
+<!-- default rule -> copy element, attributes and recursive content -->
<xsl:template match="*">
<xsl:copy >
<xsl:copy-of select="@*"/>
@@ -14,7 +15,9 @@
</xsl:copy>
</xsl:template>
-<xsl:template match="comment()">
+<!-- toplevel comments need linefeeds around them
+ as toplevel whitespace is not processed -->
+<xsl:template match="/comment()">
<xsl:text>
</xsl:text>
<xsl:copy >
@@ -24,37 +27,52 @@
</xsl:text>
</xsl:template>
+<!-- all other comments are just copied -->
+<xsl:template match="*/comment()">
+ <xsl:copy >
+ <xsl:apply-templates/>
+ </xsl:copy>
+</xsl:template>
+
+<!-- ignore funcsynopsis tags -->
<xsl:template match="*/funcsynopsis">
<xsl:apply-templates/>
</xsl:template>
+<!-- convert foncprototype to methodsynopsis -->
<xsl:template match="*/funcsynopsis/funcprototype">
<methodsynopsis>
<xsl:apply-templates/>
</methodsynopsis>
</xsl:template>
+<!-- ignore funcdef tag -->
<xsl:template match="*/funcsynopsis/funcprototype/funcdef">
<xsl:apply-templates/>
</xsl:template>
+<!-- function is now methodname in this context -->
<xsl:template match="*/funcsynopsis/funcprototype/funcdef/function">
<methodname><xsl:apply-templates/></methodname>
</xsl:template>
+<!-- first text element is the return type
+ needs to be enclused in type tags now
+-->
<xsl:template match="*/funcsynopsis/funcprototype/funcdef/text()[1]">
- <xsl:if test="position() = 1">
+ <xsl:if test="position() = 1"> <!-- first only -->
<type>
<xsl:value-of select="normalize-space(.)"/>
</type>
</xsl:if>
</xsl:template>
+<!-- paramdef is now methodparam, empty paramdef should be void/ -->
<xsl:template match="*/funcsynopsis/funcprototype/paramdef">
<xsl:choose>
<xsl:when test="count(parameter)>0">
<methodparam>
- <xsl:if test="*/optional">
+ <xsl:if test="*/optional"> <!-- optional is now attribute and not special tag
+-->
<xsl:attribute name="choice">opt</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
@@ -66,6 +84,7 @@
</xsl:choose>
</xsl:template>
+<!-- first text in paramdef is paramter type and needs type tags -->
<xsl:template match="*/funcsynopsis/funcprototype/paramdef/text()[1]">
<xsl:if test="position() = 1">
<type>
@@ -74,11 +93,12 @@
</xsl:if>
</xsl:template>
-
+<!-- ignore optional tag here, already processed above -->
<xsl:template match="*/funcsynopsis/funcprototype/paramdef/parameter/optional">
<xsl:apply-templates/>
</xsl:template>
+<!-- there is no varargs in methodsynopsis, but a rep attribute for methodparam -->
<xsl:template match="*/funcsynopsis/funcprototype/varargs">
<methodparam
rep="repeat"><type>mixed</type><parameter>...</parameter></methodparam>
</xsl:template>