|
|
@@ -1,6 +1,7 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
|
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
|
|
|
xmlns:wfs="http://www.opengis.net/wfs"
|
|
|
@@ -67,14 +68,17 @@
|
|
|
|
|
|
<xsl:template match="RelatedFeature" mode="RelatedFeatureRoot">
|
|
|
<!-- dla wstawienia root w przypadku kilku elementow zmergowanych -->
|
|
|
+ <xsl:param name="dita.map"/>
|
|
|
<xsl:element name="RelatedFeatureRoot">
|
|
|
<xsl:copy-of select="@*"/>
|
|
|
<xsl:apply-templates select="."/>
|
|
|
+
|
|
|
</xsl:element>
|
|
|
</xsl:template>
|
|
|
|
|
|
<xsl:template match="*" mode="root">
|
|
|
<xsl:param name="loop_xpath"/>
|
|
|
+ <xsl:param name="dita.map"/>
|
|
|
<xsl:element name="{name()}">
|
|
|
<xsl:copy-of select="@*"/>
|
|
|
<xsl:apply-templates>
|
|
|
@@ -118,6 +122,7 @@
|
|
|
<xsl:param name="loop_xpath" select="'root'"/>
|
|
|
<xsl:param name="feature_pos_child" select="1"/> <!-- pierwsze wyzwolenie narzuca 1 - kolejne sa z related -->
|
|
|
<!--<xsl:param name="dita_with_id" select="."/>--> <!-- TODO jest błąd - z RelatedFeatureLoop trzeba wziac mape lokalna obiektu -->
|
|
|
+ <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
<xsl:variable name="xml_id" select="@xml_id"/>
|
|
|
<xsl:variable name="RelatedFeaturePos" select="position()"/>
|
|
|
<xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
|
|
|
@@ -158,6 +163,7 @@
|
|
|
<xsl:apply-templates mode="RelatedFeature" select="$dita_fragment/RelatedFeatureRoot/*">
|
|
|
<xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
<!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ <xsl:with-param name="dita.map" select="$dita.map"/>
|
|
|
</xsl:apply-templates>
|
|
|
</xsl:for-each>
|
|
|
<!--</RelatedFeatureRoot>-->
|
|
|
@@ -335,6 +341,7 @@
|
|
|
|
|
|
<xsl:template mode="RelatedFeature" match="*">
|
|
|
<xsl:param name="loop_xpath" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/>
|
|
|
<!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
<!--<xsl:element name="{name()}">-->
|
|
|
<!--<xsl:copy-of select="@*"/>-->
|
|
|
@@ -344,6 +351,7 @@
|
|
|
<xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
<xsl:with-param name="feature_pos_child" select="position()"/>
|
|
|
<!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ <xsl:with-param name="dita.map" select="$dita.map"/>
|
|
|
</xsl:apply-templates>
|
|
|
<!--</xsl:element>-->
|
|
|
</xsl:template>
|
|
|
@@ -351,6 +359,7 @@
|
|
|
<xsl:template mode="RelatedFeatureChild" match="*">
|
|
|
<xsl:param name="loop_xpath" required="yes"/>
|
|
|
<xsl:param name="feature_pos_child" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
<!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
<xsl:element name="{local-name()}" inherit-namespaces="yes">
|
|
|
<xsl:copy-of select="namespace::node()"/>
|
|
|
@@ -359,6 +368,7 @@
|
|
|
<xsl:apply-templates mode="RelatedFeatureChild">
|
|
|
<xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
<xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <xsl:with-param name="dita.map" select="$dita.map"/>
|
|
|
<!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
</xsl:apply-templates>
|
|
|
</xsl:element>
|
|
|
@@ -367,10 +377,12 @@
|
|
|
<xsl:template mode="RelatedFeatureChild" match="RelatedFeature">
|
|
|
<xsl:param name="loop_xpath" required="yes"/>
|
|
|
<xsl:param name="feature_pos_child" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
<!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
<xsl:apply-templates select=".">
|
|
|
<xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
<xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <xsl:with-param name="dita.map" select="1"/>
|
|
|
<!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
</xsl:apply-templates>
|
|
|
</xsl:template>
|
|
|
@@ -378,20 +390,155 @@
|
|
|
<xsl:template match="*" >
|
|
|
<xsl:param name="loop_xpath"/>
|
|
|
<xsl:param name="feature_pos_child" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
<!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
<xsl:element name="{name()}">
|
|
|
- <xsl:copy-of select="@*"/>
|
|
|
+ <!--<xsl:copy-of select="@*"/>-->
|
|
|
+ <xsl:apply-templates select="@*"/>
|
|
|
<xsl:apply-templates>
|
|
|
<xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
<xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <xsl:with-param name="dita.map" select="$dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </xsl:element>
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
+ <xsl:template match="map" mode="RelatedFeatureChild" >
|
|
|
+ <xsl:param name="loop_xpath" required="yes"/>
|
|
|
+<!-- <xsl:param name="feature_pos_child" required="yes"/>-->
|
|
|
+ <!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
+ <xsl:element name="{name()}">
|
|
|
+ <xsl:apply-templates select="@*"/>
|
|
|
+ <xsl:apply-templates mode="RelatedFeatureChild">
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <!--<xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>-->
|
|
|
+ <xsl:with-param name="dita.map" select="1"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="position()"/>
|
|
|
<!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
</xsl:apply-templates>
|
|
|
</xsl:element>
|
|
|
</xsl:template>
|
|
|
|
|
|
+ <xsl:template match="topic" mode="RelatedFeatureChild" >
|
|
|
+ <xsl:param name="loop_xpath"/>
|
|
|
+ <xsl:param name="feature_pos_child" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
+ <!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$dita.map">
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="./*">
|
|
|
+ <topicref href="{$uuid}.topic_{generate-id()}.dita">
|
|
|
+ <xsl:apply-templates mode="RelatedFeatureChild">
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <xsl:with-param name="dita.map" select="$dita.map"/>
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </topicref>
|
|
|
+ <debug>
|
|
|
+ <xsl:copy-of select="."></xsl:copy-of>
|
|
|
+ </debug>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:comment>not any child at @xml_id=<xsl:value-of select="@xml_id"/>; </xsl:comment>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:element name="{name()}">
|
|
|
+ <xsl:copy-of select="@*"/>
|
|
|
+ <xsl:apply-templates mode="RelatedFeatureChild">
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </xsl:element>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
+ <xsl:template match="title" mode="RelatedFeatureChild"><!-- dodaje element parent -->
|
|
|
+ <xsl:param name="loop_xpath"/>
|
|
|
+ <xsl:param name="feature_pos_child" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$dita.map"/>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:element name="{name()}">
|
|
|
+ <!--<xsl:copy-of select="@*"/>-->
|
|
|
+ <xsl:apply-templates mode="RelatedFeatureChild">
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </xsl:element>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
+ <xsl:template match="body" mode="RelatedFeatureChild">
|
|
|
+ <xsl:param name="loop_xpath"/>
|
|
|
+ <xsl:param name="feature_pos_child" required="yes"/>
|
|
|
+ <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
|
|
|
+ <!--<xsl:param name="dita_with_id" required="yes"/>-->
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$dita.map">
|
|
|
+ <!--<xsl:attribute name="result-document-created" select="true()"/>-->
|
|
|
+ <xsl:comment>result-document-created</xsl:comment>
|
|
|
+ <xsl:result-document href="{$temp}/{$uuid}.topic_{generate-id(../.)}.dita">
|
|
|
+ <xsl:element name="{../name()}">
|
|
|
+ <xsl:copy-of select="../namespace::node()"/>
|
|
|
+ <xsl:copy-of select="../@xsi:noNamespaceSchemaLocation"/>
|
|
|
+ <xsl:attribute name="id" select="$loop_xpath"/>
|
|
|
+ <xsl:apply-templates select="../title">
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <!--<xsl:with-param name="dita.map" select="true()"/>-->
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ <xsl:element name="{name()}">
|
|
|
+ <!--<xsl:copy-of select="@*"/>-->
|
|
|
+ <xsl:apply-templates>
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <!--<xsl:with-param name="dita.map" select="true()"/>-->
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </xsl:element>
|
|
|
+ <xsl:apply-templates>
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <xsl:with-param name="dita.map" select="$dita.map"/>
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </xsl:element>
|
|
|
+ </xsl:result-document>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:element name="{name()}">
|
|
|
+ <!--<xsl:copy-of select="@*"/>-->
|
|
|
+ <xsl:apply-templates>
|
|
|
+ <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
|
|
|
+ <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
|
|
|
+ <!--<xsl:with-param name="dita.map" select="true()"/>-->
|
|
|
+ <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
|
|
|
+ </xsl:apply-templates>
|
|
|
+ </xsl:element>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
<xsl:template match="@*">
|
|
|
<xsl:copy-of select="."/>
|
|
|
</xsl:template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<xsl:template match="@xml_id|@xpath_token_filter|@xpath_token"/>
|
|
|
|
|
|
|