XPATH question - not FOP related
This is obviously off-topic, but since I have been subscribed to this list for a few months I know that you folks will be the most likely to answer this. I have been searching the various references, but I am not even sure what I should be looking for. Here is the situation: I am using xsl:for-each to loop through some data. For every pass after the first I want to insert another command. How do I test to see whether this is the first pass? example: xsl:for-each select="some_data" xsl:if test="is not the first" This is not the first! /xsl:if Repeating section... /xsl:for-each Thank you for your help. -Brian
Re: XPATH question - not FOP related
That did it. Thanks! I knew I could rely on y'all. - Original Message - From: Scott Moore To: '[EMAIL PROTECTED]' Sent: Tuesday, January 22, 2002 10:25 AM Subject: RE: XPATH question - not FOP related Try: xsl:for-each select="some_data" xsl:if test="position() 1" This is not the first! /xsl:if Repeating section... /xsl:for-each Scott
Fw: xslt and number formats
Sorry this is probably not the most appropriate forum, but I have looked everywhere I can think of. If anyone on this list can point me in the right direction I would be grateful. Thanks, Brian - Original Message - From: Brian T. Wolf [EMAIL PROTECTED] Newsgroups: comp.text.xml Sent: Tuesday, November 27, 2001 2:04 PM Subject: xslt and number formats OK, I am at my wits' end. I have looked at various sites, specs, and FAQ's, and I just am not getting an understanding of number formatting. I am using templates to transform my XML data into a table after which I will have column totals. I am using the sum() function and the math seems to be working as expected - with one minor hitch: the decimals are being truncated. Since I am printing invoices dealing with currency it is essential that the decimals remain down to the penny. Can someone explain this in clear English for me, or else point me somewhere I may not have yet seen? sample XML: taxes tax_item descriptionFederal Excise Tax/description amount2.25/amount /tax_item tax_item descriptionState 911 Emergency Tax/description amount0.54/amount /tax_item /taxes sample XSL: xsl:template match=taxes !-- cut irrelevant table info -- fo:table-row fo:table-cell fo:block xsl:value-of select=sum(tax_item/amount)/ /fo:block /fo:table-cell /fo:table-row !-- other irrelevant table info -- /xsl:template I am using xalan-2.0.0 for the transformation, if that makes a difference. Thanks much, Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: xslt and number formats
Silly me, the sample I included in the message is not what I was really using. Instead of xsl:value-of select=sum(tax_item/amount)/ I was really using xsl:number value=sum(tax_item/amount)/. The value-of does seem to work better - thanks! I still need to include your suggestion for the format-number, however if I use after the decimal as you suggest then trailing zeroes are omitted. So instead I have put in 0.00 and that seems to do the trick. -Brian - Original Message - From: Ramin Firoozye [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 9:24 AM Subject: RE: xslt and number formats Hi Brian, I tried your code in Xalan (C and J) and MSXML and got '2.79' (with the digits after decimal point intact). The XSLT spec says that numbers are kept in double format internally so you shouldn't be getting any truncation loss as a result of doing math. The 'sum' function is also supposed to keep numbers in their original format. The only culprit may be the xsl:value-of instruction (although on my system, it's working fine). You might want to try to force a format using something like: xsl:value-of select=format-number(sum(tax_item/amount), '.#') / The '#' characters default to the formatting scheme defined in the JDK 1.1 java.text.DecimalFormat class http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html . Hope this helps, Ramin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Embedding Printer Control parameters in PCL
We are working on that as well, though I don't have any good solutions yet either. If you run across something please let me know. Just as an FYI, I tried hardcoding a duplex print escape sequence into PCLRenderer.java and it printed both sides as expected. So I figure once we solve how to pass through the landscape code, this should be resolved as well. There is more to this than a FOP coding issue I believe however. The xsl:fo standard has nothing to do with how a particular printer should behave. So we also need to figure out how to get the information from the stylesheet to the renderer without damaging the integrity of the xsl. Regards, Brian - Original Message - From: Raj [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 12, 2001 7:45 AM Subject: Embedding Printer Control parameters in PCL Hi Art, I am trying to send fop generated PCL from web server to network printers. For each document, we know the print controls(like duplex etc.) Is there a way to embed these controls as part of the PCL stream so that duplex prints are automatically delivered as duplex without any other intervention. All our printers support duplex printing. Thanks -rajendran. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
orientation
I am trying to utilize the code in PCLRenderer that will send the landscape escape sequence. Unfortunately I cannot seem to figure out how to pass the information from the stylesheet to the renderer. If someone is already working on this I can wait a little bit; otherwise any advice on how to proceed to make the coding changes would be appreciated. Thanks, Brian
TXTRenderer
Is anyone else using the TXTRenderer? It seems that when I try it my pages all appear twice as wide as they are supposed to and the letter spacing is all funky. Is that already documented? If not, does anyone have any workarounds or ways to fix this? Thanks, Brian