-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement file not found for XIncludes (#462)
* Implement file not found for XIncludes in script libexec/daps-xmlwellformed * Add option -W/--warnings-as-errors to turn any warnings about missing files into errors * Integrate new xinclude.xsl stylesheets which handles manual resolution of XInclude elements * Introduce two new Python extension functions: s:exists and s:abspath. Both are basically mappend to os.path.exists and os.path.abspath * This code supports lxml >V3.4.0 This works on docserv (Leap 42.3) now
- Loading branch information
Showing
2 changed files
with
166 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Pupose: | ||
Process xi:include elements and return warning message if file | ||
cannot be found | ||
Parameters: | ||
n/a | ||
Input: | ||
DocBook 4/5 document | ||
Output: | ||
nothing, only INFO or WARNING messages | ||
Dependencies: | ||
s:abspath and s:exists, two Python extension functions used by | ||
the daps-xmlwellformed script | ||
Author: Thomas Schraitle | ||
Copyright (C) 2018 SUSE Linux GmbH | ||
--> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xi="http://www.w3.org/2001/XInclude" | ||
xmlns:s="urn:x-suse:ns:python" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
|
||
<xsl:output method="text"/> | ||
<xsl:template match="text()"/> | ||
|
||
<xsl:template match="xi:include"> | ||
<xsl:variable name="abspath" select="s:abspath(@href)"/> | ||
<xsl:choose> | ||
<xsl:when test="s:exists(@href)"> | ||
<xsl:message>INFO: XIncluding <xsl:value-of select="$abspath"/></xsl:message> | ||
<xsl:apply-templates select="document($abspath, .)"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:message>WARN:<xsl:value-of select="@href"/></xsl:message> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |