Problem with adding padding and border to an image
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 23
- Joined: Wed Jul 24, 2013 12:40 am
Problem with adding padding and border to an image
I'm trying to add padding and a border around images but cannot get my code to work correctly. The code is currently as follows:
So, if the outputclass is 'Border' I want an image with 5px padding with a 1pt border. However, the border is coming out as 5px thick. If I move the padding line to after the </xsl:attribute> line the padding and border are drawn correctly, but then all images have padding, which is not what I require.
Can anyone tell me what the problem is and how to fix it?
Thanks
Code: Select all
<xsl:attribute-set name="image">
<xsl:attribute name="border">
<xsl:if test="@outputclass='Border'">
<xsl:attribute name="padding"> 5px </xsl:attribute>
<xsl:attribute name="border"> solid 1pt blue </xsl:attribute>
</xsl:if>
</xsl:attribute>
</xsl:attribute-set>
Can anyone tell me what the problem is and how to fix it?
Thanks
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Problem with adding padding and border to an image
Hi,
This is for DITA to PDF, right?
You could do something like:
In what you tried you nested an xsl:attribute inside another one which is incorrect.
Regards,
Radu
This is for DITA to PDF, right?
You could do something like:
Code: Select all
<xsl:attribute-set name="image">
<xsl:attribute name="border">
<xsl:choose>
<xsl:when test="@outputclass='Border'">
solid 1pt blue
</xsl:when>
<xsl:otherwise>0pt</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="padding">
<xsl:choose>
<xsl:when test="@outputclass='Border'">
5px
</xsl:when>
<xsl:otherwise>0px</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service