Skip to content

Commit

Permalink
fix factorization in distro (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed Jun 4, 2023
1 parent cc7adde commit feba24b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
17 changes: 17 additions & 0 deletions Scripts/parlamint-factorize-teiHeader.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:preserve-space elements="catDesc seg"/>

<xsl:import href="parlamint-lib.xsl"/>

<xsl:variable name="pref">
<xsl:choose>
<xsl:when test="$prefix"><xsl:value-of select="$prefix"/></xsl:when>
Expand Down Expand Up @@ -118,6 +120,21 @@
</xsl:element>
</xsl:template>

<xsl:template match="tei:classDecl/xi:include | tei:particDesc/xi:include">
<xsl:variable name="path" select="concat($outDir,'/',@href)"/>
<xsl:message select="concat('INFO: Copying ',@href, ' to ',$path)"/>
<xsl:result-document href="{$path}" method="xml">
<xsl:apply-templates mode="XInclude" select="document(@href)"/>
</xsl:result-document>
<xsl:element name="xi:include" namespace="http://www.w3.org/2001/XInclude">
<xsl:namespace name="xi" select="'http://www.w3.org/2001/XInclude'"/>
<xsl:attribute name="href">
<xsl:value-of select="./@href"/>
</xsl:attribute>
</xsl:element>
</xsl:template>


<xsl:template match="@scheme[. = '#parla.legislature']">
<xsl:attribute name="scheme">#ParlaMint-taxonomy-parla.legislature</xsl:attribute>
</xsl:template>
Expand Down
13 changes: 5 additions & 8 deletions Scripts/parlamint2distro.pl
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,11 @@ sub factorisations {
if (@inTaxonomies) {$factorised = 1}
elsif (not $procFactor) {print STDERR "WARN: $inTaxonomies not found\n"}
if ($procFactor or $procCommon) {
if ($factorised) {print STDERR "INFO: $Dir already factorised\n"}
else {
print STDERR "INFO: Factorising $Root\n";
$tmpOutDir = "$tmpDir/factorise";
#Doesn't work!
#$Saxon noAna=\"$factoriseFiles\" $teiRootTaxonomies outDir=$tmpOutDir -xsl:$scriptFactor $Root`;
#`cp $tmpOutDir/*.xml $Dir`;
}
if ($factorised) {print STDERR "INFO: $Dir already (fully/partially) factorised\n"}
print STDERR "INFO: Factorising $Root\n";
$tmpOutDir = "$tmpDir/factorise";
`$Saxon noAna=\"$factoriseFiles\" $teiRootTaxonomies outDir=$tmpOutDir -xsl:$scriptFactor $Root`;
`cp $tmpOutDir/*.xml $Dir`;
if ($procCommon) {
foreach my $taxonomy (sort keys %taxonomy) {
#Eventually we will need an XSLT to extract from common taxonomies catDesc with relevant @xml:lang(s)!
Expand Down

0 comments on commit feba24b

Please sign in to comment.