pdf generation - XSLT: Adding an XML Hyperlink to Another XML Value -
i trying hyperlink value. hyperlink stored in xml well. used output pdf's line items.
this current code:
<fo:block font-size="8pt"> <fo:inline> <xsl:value-of select="substring-before(_preload_product_id, " - ")" /> </fo:inline> </fo:block>
i want able add together hyperlink substring. actual url link, mentioned, comes xml looks xsl:
<xsl:value-of select="cf_customer_quotation_line_item_product_url" />
i have been looking around find code more geared websites, doing pdf. know if possible add together same hyperlink image below:
<fo:block> <fo:external-graphic src="url()" content-height="2cm"> <xsl:attribute name="src"> <xsl:value-of select="cf_customer_quotation_line_item_image_url"/> </xsl:attribute> </fo:external-graphic> </fo:block>
wrap image (or whatever else want become link) in fo:basic-link
for example:
<fo:block> <fo:basic-link external-link="url(--url link destination--)"> <fo:external-graphic src="url(--url image--)" content-height="2cm" /> </fo:basic-link> </fo:block>
to utilize concrete values example. have image on hard drive d:\images\smiley.jpg
. url of hyperlink's destination in element accessible xsl named cf_customer_quotation_line_item_product_url
(as in example), above becomes:
<fo:block> <fo:basic-link external-link="url({cf_customer_quotation_line_item_product_url})"> <fo:external-graphic src="url(d:\images\smiley.jpg)" content-height="2cm" /> </fo:basic-link> </fo:block>
the curly brackets in external-link
s url() value cause evaluation kind of value-of
within attribute.
further edit (based on reply):
change this
<fo:block> <fo:basic-link> <xsl:attribute name="external-destination"> <xsl:value-of select="cf_customer_quotation_line_item_product_url"/> </xsl:attribute> <fo:external-graphic src="url()" content-height="2cm"> <xsl:attribute name="src"> <xsl:value-of select="cf_customer_quotation_line_item_image_url"/> </xsl:attribute> </fo:external-graphic> </fo:basic-link> </fo:block>
to this
<fo:block> <fo:basic-link external-destination="url({cf_customer_quotation_line_item_product_url})" text-altitude="2cm"> <fo:external-graphic src="url({cf_customer_quotation_line_item_image_url})" content-height="2cm" /> </fo:basic-link> </fo:block>
if find still doesn't work, seek clicking @ bottom of image - may hypertext part "text high". if happening you, add together text-altitude
fo:basic-link
same height image (i've updated illustration above).
xml pdf-generation xsl-fo
No comments:
Post a Comment