On 17.01.2022 23:36, rick(_at_)rickquatro(_dot_)com wrote:
Hi All,
I have some <note> elements that I want to convert to tables, so I have
the following template:
<!-- Convert caution and warning notes to simpletables. -->
<xsl:template match="note[@type='caution' or @type='warning']">
<simpletable relcolwidth="100*" frame="all" outputclass="{@type}">
<sthead><stentry>{@type => upper-case()}</stentry></sthead>
<strow>
<stentry><xsl:apply-templates/></stentry>
</strow>
</simpletable>
</xsl:template>
However, some <note> elements are conrefs to other files. I have this
template to resolve the conrefs:
<xsl:template match="note[@conref]" priority="2">
<xsl:variable name="doc">
<xsl:choose>
<xsl:when
test="contains(@conref,'#')">{substring-before(@conref,'#')}</xsl:when>
<xsl:otherwise>{@conref}</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="id">
<xsl:if test="contains(@conref,'#')">
<xsl:variable name="scratch"
select="substring-after(@conref,'#')"/>
<xsl:choose>
<xsl:when
test="contains($scratch,'/')">{tokenize($scratch,'/')[last()]}</xsl:when>
<xsl:otherwise>{$scratch}</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="file" select="resolve-uri($doc,base-uri(.))"/>
<xsl:choose>
<xsl:when test="doc-available($file)">
<xsl:choose>
<xsl:when test="($id and $id!='')">
<xsl:copy-of select="doc($file)//*[@id=$id]"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="doc($file)/*"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:template>
I am not sure how to integrate the two templates so that I can convert
conref notes to tables too. Any pointers would be appreciated. Thank you
very much.
So what kind of element(s) does doc($file)//*[@id=$id] in
<xsl:copy-of select="doc($file)//*[@id=$id]"/>
select? "note" elements that need to be converted?
If you want to apply your template you would need
<xsl:apply-templates select="doc($file)//*[@id=$id]"/>
it seems.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--