473,473 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[xsl] representing checkboxes (with images)

2 New Member
This is doing my head in...

We're starting to migrate our report-printing and such (forms included) to pdf - using xml files and nFOP with asp.net. In this case I have to print out a form which contains a whole lot of checkboxes, so I made 2 gifs of 12x12 pixels that represent the empty and checked states. Because I use so many checkboxes, I thought about making a template with a parameter wether it should be checked or not (if the xml contains any data, otherwise everything will be blank - we have to offer both possibilities). Here's what the template looks like (I had content-width and content-height, and width and height set at some point. All the same apparently)

Expand|Select|Wrap|Line Numbers
  1. <xsl:template name="checkbox">
  2.   <xsl:param name="checked" />
  3.     <xsl:choose>
  4.       <xsl:when test="$checked='false'">
  5.         <fo:external-graphic  src="url('http://krokador.freepgs.com/checkboxOff.gif')"/>
  6.       </xsl:when>
  7.       <xsl:when test="$checked='true'">
  8.     <fo:external-graphic src="url('http://krokador.freepgs.com/checkboxOn.gif')" />
  9.       </xsl:when>
  10.     </xsl:choose>
  11. </xsl:template>
  12.  
and in my code for the moment - since i dont have access to the db the form will take its data from right now - I have this to call the template:
Expand|Select|Wrap|Line Numbers
  1. <fo:table-cell padding-top="2px">                                  
  2.   <fo:block>
  3.     <xsl:call-template name="checkbox">                                      
  4.       <xsl:with-param name="checked" select="'false'" />                    
  5.     </xsl:call-template>
  6.   </fo:block>
  7. </fo:table-cell>
  8.  
and I change false for true if I want it checked.

As long as its inline, the result is alright. The checkboxes will display a tad under the text level (due to the disposition of form - originally made in word - I can't use tables and put the image in a block, it would just make the structure complicated, hard to maintain, and in the end it probably would turn out just as ugly) but i can deal with that. However, if I try to shoot the textbox in a table-cell (inside of a block - like my previous code snippet) and alone, all hell breaks loose and the images display where they shouldn't be. Here's a picture to show you the problem (I added a border to the cell where the top left square is, or should be)


I would've wanted to do that and I don't think I would've managed! The checkboxes should be displaying level with the line on the left as they are in the same table-row... so why are they sticking on the top-left corner?

I have tried so many things, from a <fo:inline-container> with all sorts of positioning (alignment-adjust, alignment-baseline... etc) to putting the image inside of a floating block... I'm not quite sure what all I am supposed to do - or try - anymore. I also tried the image alone without the template: same results. the only change i can create is by adding a padding-top to the block that containts said checkbox (equal to its height) I can make it go down to its normal level. It's still way offset to the left and padding-left won't change a thing. Margin-left on the block somehow stretches the image, so im leaving that one out (and even with width and height specified). Has anyone ever come across something like this? Or does anyone have a different idea on how I would render these? Nothing seems to work. :(:confused:

Thank you in advance for your time
Oct 18 '07 #1
0 1577

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ragha | last post by:
Dear friends I am emulating thr tree structure mentioned in the article http://www.15seconds.com/issue/010921.htm I have succesfully created the folder structure for level 2 I need this...
6
by: tsirman | last post by:
hello can i put in an xsl file variables from php??? well i have 15 xsl files which have many "<a href.........." with the url of the project. so if i want to make my project portable i must have...
2
by: DonMiche | last post by:
I'm having trouble producing an xml output from another xml file using xsl. The proper values are output to the browser as text with no formating or xml tags (<rowset> and <row>). Any ideas? ...
1
by: j erickson | last post by:
with the following xsl and xml file, the display of the gif file with the <image/url> tag works. However, the gif file in the <description> tag using the name attribute "src" won't make the correct...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.