Merging MET data with PDF2 plugin

I need to merge some of the metadata from MET files into my PDF output. I have a plugin that is supposed to do just this, but I'm having some trouble setting and getting the variables.

Has anyone else done something similar? If you have sample code, that would be fantastic.

Parents
  • Bill,

    In the PDF2 plugin resource XSL files there is a stylesheet - topicmerge.xsl. This sheet merges the content into a single file for processing into XSL:FO.

    There are probably better ways, as I consider my stylesheet skill intermediate, but I've added this logic into matches where I want to pull metadata.

    <xsl:variable name="metPath" select="concat('file:///',translate(replace(@xtrf,'.xml','.met'),'\','/'))"/>
    <xsl:attribute name="libraryType"><xsl:value-of select="document($metPath)/ishobject/ishfields/ishfield[@name='FLIBRARYTYPE']"/>/xsl:attribute>

    metPath is a valid URI to the met file . The @xtrf is set by an earlier sheet in the transform that is basically the filepath to your working XML file. Since the MET files are dumped into that same folder I just replace .XML with .MET and properly format the string to URI.

    Once you've declared the variable with the proper path you can use the xpath function document() to pull data from the file. The given example pulls library topic type for a concept template.

    Hope this helps.

    David A
Reply
  • Bill,

    In the PDF2 plugin resource XSL files there is a stylesheet - topicmerge.xsl. This sheet merges the content into a single file for processing into XSL:FO.

    There are probably better ways, as I consider my stylesheet skill intermediate, but I've added this logic into matches where I want to pull metadata.

    <xsl:variable name="metPath" select="concat('file:///',translate(replace(@xtrf,'.xml','.met'),'\','/'))"/>
    <xsl:attribute name="libraryType"><xsl:value-of select="document($metPath)/ishobject/ishfields/ishfield[@name='FLIBRARYTYPE']"/>/xsl:attribute>

    metPath is a valid URI to the met file . The @xtrf is set by an earlier sheet in the transform that is basically the filepath to your working XML file. Since the MET files are dumped into that same folder I just replace .XML with .MET and properly format the string to URI.

    Once you've declared the variable with the proper path you can use the xpath function document() to pull data from the file. The given example pulls library topic type for a concept template.

    Hope this helps.

    David A
Children