xslt - XPath selector not working during PDF transformation -
i have dita bookmap storing image paths:
<bookmap> <bookmeta> <data id="productlogo"> <image href="images/_notrans/frontcover/productlogo.svg" /> </data> <data id="productphoto" > <image href="images/_notrans/frontcover/productphoto.jpg" /> </data> </bookmeta> </bookmap>
then attempt grab href values data[@id]:
<xsl:variable name="productlogo"><xsl:value-of select="//data[@id='productlogo']/image/@href" /></xsl:variable> <xsl:variable name="productphoto"><xsl:value-of select="//data[@id='productphoto']/image/@href" /></xsl:variable>
(these xpath expressions match href when test against bookmap in oxygen.)
during transformation output:
<xsl:message>productphoto: <xsl:value-of select="$productphoto"/></xsl:message>
the value-of empty.
however, works expected if replace id attribute numbers:
<xsl:variable name="productlogo"><xsl:value-of select="//data[1]/image/@href" /></xsl:variable> <xsl:variable name="productphoto"><xsl:value-of select="//data[2]/image/@href" /></xsl:variable>
what doing wrong that's preventing using @id="whatever"?
the xslt not applied directly on bookmap contents, applied on xml document contains bookmap topic references expanded in , preprocessing applied it. if set "clean.temp" parameter "no" find in temporary files folder file called "mapname_merged.xml", xml document on xslt applied , see in it, ids have been changed unique in context of entire xml document.
when working data elements should set @name attribute them like:
<data name="productlogo">
and match name in xslt code. there examples of using "data" in dita 1.2 specs well:
http://docs.oasis-open.org/dita/v1.2/os/spec/langref/data.html#data
Comments
Post a Comment