Re: [xsl] Running a stylesheet with Python

Subject: Re: [xsl] Running a stylesheet with Python
From: "dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Aug 2025 16:24:25 -0000
So this looks absolute to me, here is the definition

<xsl:param name="srcPath"
select="substring-before(base-uri(.), tokenize(base-uri(.), '/')[last()])"/>


	<xsl:variable name="MODULES_LOC" >
		<xsl:choose>
			<xsl:when test="$MODE='p1'">
				<xsl:text>../../../../asciidoc/modules/</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>../asciidoc/modules/</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

<xsl:variable name="PARTIALS" select="substring-after(concat($srcPath, $MODULES_LOC, 'ROOT/partials/'), 'file:')"/>

It is based upon the input XML file and then adds a relative path from there.

One of the called templates before this that works has this content

	<xsl:template name="build-antora-yml">
		<xsl:param name="START-PAGE"/>
		<xsl:param name="COLLECTION-TITLE"/>

<xsl:result-document method="text" href="{concat($srcPath, $MODULES_LOC, '../antora.yml')}">
<xsl:text>name: </xsl:text><xsl:value-of select="$COLLECTION-NAME"/><xsl:value-of select="$RETURN"/>
<xsl:text>title: "</xsl:text><xsl:value-of select="$COLLECTION-TITLE"/><xsl:text>"</xsl:text><xsl:value-of select="$RETURN"/>
<xsl:text>version: ~</xsl:text><xsl:value-of select="$RETURN"/>
<xsl:text>start_page: ROOT:</xsl:text>
<xsl:value-of select="$START-PAGE"/>
<xsl:value-of select="$RETURN"/>


<xsl:value-of select="$RETURN"/>

<xsl:text>nav:</xsl:text><xsl:value-of select="$RETURN"/>
<xsl:value-of select="$spaceTAB"/><xsl:text>- modules/ROOT/nav.adoc</xsl:text><xsl:value-of select="$RETURN"/>



<xsl:text>asciidoc: </xsl:text><xsl:value-of select="$RETURN"/>


<xsl:value-of select="$spaceTAB"/><xsl:text>attributes: </xsl:text><xsl:value-of select="$RETURN"/>

				<!-- Process the values in the vars file to create the variables -->
			<xsl:for-each select="document($varFILE)/variables/variable">
				<xsl:variable name="var" select="normalize-space(.)"/>
				<xsl:if test="$var != ''">
					<xsl:value-of select="ping:antoraformat($var, 'noteditable')"/>
					<xsl:value-of select="$RETURN"/>
				</xsl:if>
			</xsl:for-each>

		</xsl:result-document>
	</xsl:template>



..dan

On 2025-08-26 15:54, Martin Honnen martin.honnen@xxxxxx wrote:
On 27/08/2025 00:34, dvint@xxxxxxxxx wrote:
I'm not seeing where the output is escaping. So I tried getting rid of the call template like this:

\xA0\xA0\xA0\xA0\xA0\xA0\xA0 <xsl:result-document href="{concat($PARTIALS, $topicid, '_EP.adoc')}">


So the question is whether your attempt with

\xA0 concat($PARTIALS, $topicid, '_EP.adoc')

constructs an absolute file URI or whether it ends up being a relative URI.

In the latter case I think, you will get the error as then, as Michael
already pointed out, Saxon tries to resolve the relative URI against
the base output URI you haven't set.

Current Thread