summaryrefslogtreecommitdiff
path: root/writerfilter/source/resourcemodel/namespace_preprocess.pl
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/resourcemodel/namespace_preprocess.pl')
-rw-r--r--writerfilter/source/resourcemodel/namespace_preprocess.pl25
1 files changed, 5 insertions, 20 deletions
diff --git a/writerfilter/source/resourcemodel/namespace_preprocess.pl b/writerfilter/source/resourcemodel/namespace_preprocess.pl
index 22c172329f61..66644b70fd47 100644
--- a/writerfilter/source/resourcemodel/namespace_preprocess.pl
+++ b/writerfilter/source/resourcemodel/namespace_preprocess.pl
@@ -30,31 +30,16 @@ EOF
# print the mapping
open ( NAMESPACES, $ARGV0 ) || die "can't open namespace file: $!";
-$group = 0;
-$i = 1;
while ( <NAMESPACES> )
{
chomp( $_ );
- $_ =~ s/\s*//g;
- if ( $_ =~ m/^$/ )
- {
- # Start a new group
- $i = 0;
- $group++;
- }
- elsif ( $_ =~ m/^[^#]/ )
- {
- # Neither an empty line nor a comment
- $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_";
- $_ =~ s/-/_/g;
- $no = $group*10 + $i;
- print <<EOF;
- <xsl:when test="\$id = '$_'">
- <xsl:text>$no</xsl:text>
+ # line format is: numeric-id short-name namespace-URL
+ $_ =~ /^([0-9]+)\s+([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid character in input data";
+ print <<EOF;
+ <xsl:when test="\$id = '$2'">
+ <xsl:text>$1</xsl:text>
</xsl:when>
EOF
- ++$i;
- }
}
print <<EOF;