Xslt variable in apache fop embedded file declarations

The Nightmare :

I have a embedded file in my xsl file, example like this:

<xsl:template match="$pathPrefix/tns:AdditionalInfoStruct/tns:AdditionalInfo/dtsf:File">      
      <pdf:embedded-file filename="file.txt" src="data:text/html;base64,c2tsZGFsa2RhbnNrbHhuYXNrbGRrbGFzZGp3amRvcGFzZGpsc2RrYXNjbXNrbGNtYXNrbGQ7YXNz"/>
</xsl:template>

Above example works fine but when i want get filename and content in base64 from my xslt node didn't work. Not working example:

<xsl:template match="$pathPrefix/tns:AdditionalInfoStruct/tns:AdditionalInfo/dtsf:File">      
<xsl:variable name="name" select="current()/dtsf:Name"/>
<xsl:variable name="content" select="current()/dtsf:Content"/>
      <pdf:embedded-file filename="$name" src="data:text/html;base64,$content"/>
</xsl:template>

Why I can't use variables in filename and src param in pdf:embedded tag? Mayby I can add attachment programatically to my pdf in java? Anybody know how?

Maurice Perry :

I would try something like so:

<pdf:embedded-file>
    <xsl:attribute name="filename"><xsl:value-of select="$name"/></xsl:attribute>
    <xsl:attribute name="src">data:text/html;base64,<xsl:value-of select="$content"/></xsl:attribute>
</pdf:embedded-file>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=101583&siteId=1