Access a map parameter during the XHTML processing #4438
-
Hello there, I have already implemented this plugin for HTML5 output, but while trying to use the XHTML transtype, I notice I am not able to retrieve the information from the map. The plugin is quite simple. Here it is attached: I've used this declaration in the plugin.xml: <?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.toto.othermeta.xhtml">
<feature extension="dita.conductor.xhtml.param" file="buildXhtmlParam.xml"/>
<feature extension="dita.conductor.xhtml.toc.param" file="buildXhtmlParam.xml"/>
<feature extension="dita.xsl.xhtml" file="./xsl/get-move-othermeta.xsl"/>
</plugin> The buildXhtmlParam includes this info: <params xmlns:if="ant:if">
<param name="input.map.url" expression="${xhtml.map.url}" if:set="xhtml.map.url"/>
</params> And after in my xslt I just declare the following verifications: <xsl:param name="input.map.url" as="xs:string?"/>
<xsl:variable name="mapDoc" as="document-node()?">
<xsl:apply-templates select="document($input.map.url)" mode="normalize-map"/>
</xsl:variable>
<xsl:template match="/">
<xsl:message>Value of input.map.url: <xsl:value-of select="$mapDoc"/></xsl:message>
<xsl:if test="$mapDoc">
<xsl:message>Document loaded successfully from <xsl:value-of select="document-uri($mapDoc)"/></xsl:message>
<xsl:message>Number of nodes in the document: <xsl:value-of select="count($mapDoc//*)"/></xsl:message>
</xsl:if>
.... Surprisingly, as explained before, the same plugin worked well for html5. Of course, the definition of the param used to communicate info with the map differed and relied onto another declaration: <?xml version="1.0" encoding="UTF-8"?>
<params xmlns:if="ant:if">
<param name="input.map.url" expression="${html5.map.url}" if:set="html5.map.url"/>
</params> Do you have any idea where the issue lies? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Linking for completeness also to the discussion on the Oxygen forum: https://www.oxygenxml.com/forum/post73844.html#p73844 |
Beta Was this translation helpful? Give feedback.
-
I had a similar problem in the past. This was my way to get it working: Set your local param like this: <?xml version="1.0" encoding="UTF-8"?>
<extension>
<param name="input.map.url" expression="${dita.temp.dir}${file.separator}${user.input.file}"/>
</extension> In the XSLT you can refer to the file like this to load it: <xsl:param name="input.map.url" as="xs:string?"/>
<xsl:variable name="escapedFilePath" select="replace($input.map.url, '\\', '/')"/>
<xsl:variable name="replaceSpaces" select="replace($escapedFilePath, ' ', '%20')"/>
<xsl:variable name="concatUri" select="concat('file:/', $replaceSpaces)"/>
<xsl:variable name="strippedUri" select="replace($concatUri, '//', '/')"/>
<xsl:variable name="mapDoc" select="document($strippedUri)"/> I've updated the plugin here: com.toto.othermeta.xhtml.zip |
Beta Was this translation helpful? Give feedback.
I had a similar problem in the past. This was my way to get it working:
Set your local param like this:
In the XSLT you can refer to the file like this to load it: