Page 1 of 1

Need help using a data element for PDF cover processing

Posted: Tue Jul 14, 2015 5:02 pm
by kmank
Hello,

I have a few select attributes (props, otherprops, etc) that I have been using for processing items such as date and subtitle for PDF cover pages. I understand how to call the map elements in the XSL file (<xsl:variable name="otherprops">), but not how to call the name and value of a data element in this context.
<map>
<data>
<data>
<topicref>
<topicref>
...


Can anyone suggest some help please? Thanks!

Re: Need help using a data element for PDF cover processing

Posted: Wed Jul 15, 2015 12:03 pm
by Radu
Hi,

I'm sorry but I don't quite understand all your setup.

So if at some point in the DITA Map you have a construct like:

Code: Select all

 <topicmeta>
........
<data name="X" value="Y"></data>
....
</topicmeta>
then in the XSLT you can retrieve the value of the element using an XPath like:

Code: Select all

<xsl:value-of select="(//data[@name='X'])[1]/@value"/>
Regards,
Radu

Re: Need help using a data element for PDF cover processing

Posted: Mon Jul 20, 2015 6:15 pm
by kmank
Thanks for the reply, Radu

The code that I am using to call the select attributes looks like this:

Code: Select all

<xsl:variable name="otherprops">
<!-- Date: Insert the Revision Month and Year -->
<xsl:choose>
<xsl:when test="//*[contains(@class,' bkinfo/bkinfo ')]">
<xsl:value-of select="//*[contains(@class,' bkinfo/bkinfo ')]/*[contains(@class,' topic/otherprops ')]"></xsl:value-of>

<xsl:apply-templates select="//*[contains(@class,' bkinfo/bkinfo ')]/@id"/>
</xsl:when>
<xsl:when test="string(@otherprops)"><xsl:value-of select="string(@otherprops)"/></xsl:when>
<xsl:when test="normalize-space(otherprops)"><xsl:value-of select="otherprops"/></xsl:when>
<xsl:otherwise>
<fo:block color="red">[No date was entered. Enter the Month and Year (ex. April 2011) in the otherprops attribute]</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
So, really, I think the issue is how to test if the data element (<data name="pubdate" value="May 2015"/>) exists in the test. It appears I cannot call the string you provided in the test, or at least how to configure it properly.

Thanks for your help! Greatly appreciated!

Re: Need help using a data element for PDF cover processing

Posted: Mon Aug 03, 2015 2:47 pm
by Radu
Hi,

I'm sorry but I do not have enough details to help further. I do not know the entire XSLT customization you made.
In my previous example I was trying to show you how an XPath which searches for that data value should look like but you need to adapt my example to your particular situation.
Maybe you could also write about this on the DITA Users List:

https://groups.yahoo.com/neo/groups/dita-users/info

Regards,
Radu