131 |
131 |
132 <xsl:template match="*" mode="scan-for-namespaces"/> <!-- just in case of errors, consider replacing by terminate --> |
132 <xsl:template match="*" mode="scan-for-namespaces"/> <!-- just in case of errors, consider replacing by terminate --> |
133 <xsl:template match="*[@href and not(self::meta)]" mode="scan-for-namespaces"> |
133 <xsl:template match="*[@href and not(self::meta)]" mode="scan-for-namespaces"> |
134 <!-- produce a list of namespace-prefix namespace pairs separated by newlines, in reverse order found in documents |
134 <!-- produce a list of namespace-prefix namespace pairs separated by newlines, in reverse order found in documents |
135 reverse order so we can try to use the first namespace prefix defined if it's available--> |
135 reverse order so we can try to use the first namespace prefix defined if it's available--> |
136 <xsl:for-each select="document(@href,.)/*"> |
136 <xsl:variable name="linked" select="document(@href,.)/*"/> |
|
137 <xsl:for-each select="$linked"> |
137 <xsl:apply-templates select="//*[(self::component or self::collection or self::package or self::layer) and @href]" mode="scan-for-namespaces"/> |
138 <xsl:apply-templates select="//*[(self::component or self::collection or self::package or self::layer) and @href]" mode="scan-for-namespaces"/> |
138 <xsl:for-each select="//namespace::* | @id-namespace"> |
139 <xsl:for-each select="//namespace::* | @id-namespace"> |
139 <xsl:value-of select="concat(name(),' ',.,'
')"/> |
140 <xsl:value-of select="concat(name(),' ',.,'
')"/> |
140 </xsl:for-each> |
141 </xsl:for-each> |
141 </xsl:for-each> |
142 </xsl:for-each> |
|
143 <xsl:if test="not($linked)"> |
|
144 <xsl:message>Note: The link to <xsl:value-of select="@href"/> from <xsl:value-of select="concat(name(),' ',@id)"/> could not be resolved. Perhaps there's an error in the XML?</xsl:message> |
|
145 </xsl:if> |
142 </xsl:template> |
146 </xsl:template> |
143 |
147 |
144 <xsl:template name="needed-namespaces"> |
148 <xsl:template name="needed-namespaces"> |
145 <xsl:param name="foundns"/> |
149 <xsl:param name="foundns"/> |
146 <xsl:param name="usedpre"/> |
150 <xsl:param name="usedpre"/> |