W3C home > Mailing lists > Public > www-xsl-fo@w3.org > September 2012

Re: Attribute Value

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Sun, 16 Sep 2012 15:45:07 -0400
Message-Id: <7.0.1.0.2.20120916153922.02389800@wheresmymailserver.com>
To: www-xsl-fo@w3.org
At 2012-09-16 09:43 -0700, Baha Olgun wrote:
>I am using apache fop. And
><xsl:value-of select="graphic[@href]"/> like code did not work while 
>converting to the pdf. I dont know why?

Because you are addressing the element named <graphic>, you are not 
addressing the href= attribute attached to that element.  I'm 
assuming that you want the attribute, not the element.  So you need 
to make sure the last step of your location path addresses the 
attribute itself, and assuming your current node is the parent of the 
<graphic> element, it would read as follows:

     graphic/@href

In XSL-FO (not specific to the FOP processor, but an aspect of the 
specification for all processors), the name of the graphic is 
supplied as a URL location, not as a simple value, to the 
<external-graphic> construct.

Thus your XSLT stylesheet would look something like:

   <external-graphic src='url("{graphic/@href}")'/>

... or:

   <external-graphic>
     <xsl:attribute name="src">
       <xsl:text>url("</xsl:text>
       <xsl:value-of select="graphic/@href"/>
       <xsl:text>")</xsl:text/>
     </xsl:attribute>
   </external-graphic>

I hope this helps.

. . . . . . . . . . . . Ken


--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/f/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal
Received on Sunday, 16 September 2012 19:46:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 16 September 2012 19:46:12 GMT