diff options
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/import-metadata.xsl | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/xslt/import-metadata.xsl b/xslt/import-metadata.xsl index 5a99c8bd..2edf7ed2 100644 --- a/xslt/import-metadata.xsl +++ b/xslt/import-metadata.xsl @@ -11,6 +11,26 @@ <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + <xsl:template name="string-replace-all"> + <xsl:param name="text" /> + <xsl:param name="replace" /> + <xsl:param name="by" /> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text,$replace)" /> + <xsl:value-of select="$by" /> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="substring-after($text,$replace)" /> + <xsl:with-param name="replace" select="$replace" /> + <xsl:with-param name="by" select="$by" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="/md:EntitiesDescriptor"> <xsl:apply-templates select="md:EntityDescriptor"> <!-- xsl:with-param name="output"><xsl:value-of select="$output"/></xsl:with-param --> @@ -27,14 +47,22 @@ <xsl:otherwise><xsl:value-of select="@entityID"/></xsl:otherwise> </xsl:choose> </xsl:variable> - + + <xsl:variable name="hostStr"> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="$uri" /> + <xsl:with-param name="replace" select="'%2F'" /> + <xsl:with-param name="by" select="'/'" /> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="host"> - <xsl:value-of select="normalize-space(translate($uri,'/?=:','----'))"/> + <xsl:value-of select="normalize-space(translate($hostStr,'/?=:','----'))"/> </xsl:variable> <xsl:variable name="file" select="concat($output,'/',$host,'.xml')"/> <exsl:document method="xml" indent="yes" href="{$file}"> <xsl:copy> - <xsl:apply-templates select="node()|@*"/> + <xsl:apply-templates select="node()|@*"/> </xsl:copy> </exsl:document> </xsl:template> |