Skip to content

Commit 7bfee56

Browse files
committed
Add schemafile and xml-model PI in <portal>
1 parent cb0baf3 commit 7bfee56

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/docbuild/config/xml/data/convert-v6-to-v7.xsl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
<!-- Set the main output filename -->
4747
<xsl:param name="outputfile" select="'portal.xml'" />
4848

49+
<!-- Set the RNC schema file -->
50+
<xsl:param name="schemafile"></xsl:param>
51+
4952
<!-- Set the schemaversion attribute in the output XML -->
5053
<xsl:param name="schemaversion">7.0</xsl:param>
5154

@@ -192,6 +195,28 @@
192195
</xsl:choose>
193196
</xsl:template>
194197

198+
<xsl:template name="add-pi-for-relaxng">
199+
<xsl:variable name="ext" select="substring($schemafile, string-length($schemafile) - 3)" />
200+
<xsl:if test="$schemafile != ''">
201+
<xsl:variable name="type">
202+
<xsl:choose>
203+
<xsl:when test="$ext = '.rnc'">application/relax-ng-compact-syntax</xsl:when>
204+
<xsl:when test="$ext = '.rng'">application/xml</xsl:when>
205+
<xsl:otherwise>
206+
<xsl:message terminate="yes">
207+
<xsl:text>Error: Unknown schema file extension for </xsl:text>
208+
<xsl:value-of select="$schemafile"/>
209+
<xsl:text>. Only .rnc and .rng are supported.</xsl:text>
210+
</xsl:message>
211+
</xsl:otherwise>
212+
</xsl:choose>
213+
</xsl:variable>
214+
<xsl:processing-instruction name="xml-model">
215+
<xsl:value-of select="concat(' href=&quot;', $schemafile, '&quot;')"/>
216+
<xsl:value-of select="concat(' type=&quot;', $type, '&quot;')"/>
217+
</xsl:processing-instruction>
218+
</xsl:if>
219+
</xsl:template>
195220

196221

197222
<!-- ======== General Templates -->
@@ -213,6 +238,7 @@
213238
<xsl:call-template name="write.file">
214239
<xsl:with-param name="filename" select="concat($outputdir, $outputfile)" />
215240
<xsl:with-param name="content">
241+
<xsl:call-template name="add-pi-for-relaxng" />
216242
<portal schemaversion="7.0" xmlns:xi="http://www.w3.org/2001/XInclude">
217243
<xsl:apply-templates select="categories" />
218244
<productfamilies>

0 commit comments

Comments
 (0)