Need help using a data element for PDF cover processing

Here should go questions about transforming XML with XSLT and FOP.
kmank
Posts: 79

Need help using a data element for PDF cover processing

Tue Jul 14, 2015 5:02 pm

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!
Radu
Posts: 5507

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

Wed Jul 15, 2015 12:03 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kmank
Posts: 79

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

Mon Jul 20, 2015 6:15 pm

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!
Radu
Posts: 5507

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

Mon Aug 03, 2015 2:47 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests