Posts

Showing posts from December, 2007

Bip looping

Longtime back, i answered this in the forum :) try these http://sourceware.org/ml/xsl-list/2001-05/msg00517.html http://www.biglist.com/lists/xsl-list/archives/200105/msg00515.html http://www.biglist.com/lists/xsl-list/archives/200105/msg00536.html string-length function. http://www.zvon.org:9001/saxon/cgi-bin/XLab/XML/addressbook.html?stylesheetFile=XSLT/stringFunctions.xslt TEMPLATE ++++++++++++++ <?xdoxslt:set_variable($_XDOCTX, 'cnt',string-length(.))?> <?for-each:xdoxslt:foreach_number($_XDOCTX,1,xdoxslt:get_variable($_XDOCTX, 'cnt'),1)?> X <?end for-each?> ------------------------------------------------------------------------------------------------------ XML <TEST>FIVE</TEST> this will print no.of X for the length of the string passed. so it will print "XXXX" Hope this helps

Call templates

Link <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:template name="add-X"> <xsl:param name="string" select="." /> <xsl:if test="$string"> <xsl:text>X</xsl:text> <xsl:value-of select="substring($string, 1,1)"/> <xsl:call-template name="add-X"> <xsl:with-param name="string" select="substring($string, 2)" /> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> Create an file named TEST.xsl with the above code. <aaaa>ABCDE</aaaa> Create an file named TEST.XML with the above code. Create an RTF template with form field valus as <?import: file:///C:\Desktop\Sample RTF\TEST.xsl?> Note : here you have to point the xsl path where your

Grouping in BIP :)

Image
Another query from Netherlands user Mr."Remco" He was trying to create template which he wanted to have group-left of one column, i gave him another solution of re-grouping again, ?for-each-group:ROW[(_saw_0_='Realisatie EHS')]; _saw_0_? ?_saw_0_? ?for-each-group:current-group()[ (_saw_2_='n.v.t.')]; _saw_1_? ?_saw_1_? - ?_saw_3_? - ?sum(current-group()/_saw_4_[.!=’’])? ?end for-each-group? ?end for-each-group? he could have used that in table in table , so that it would have solved it neatly. But he was not ready to add another table. He wanted to do that in single table itself. n a single table we can do it, but we have to first find , how many rows it will be there in the group, then divide them by 2 and get the ceil of that number. then add a if condition checking for position of the row = this number. if so , display the value you want to display. ?xdoxslt:set_variable($_XDOCTX, 'TYTEST', (count(xdoxslt:distinct_values(/ROWSET/ROW[(_saw_0_='Re

Rounding Issue in Release 5.6.3

This is know issue we have in Publisher Release 5.6.3, "Rounding Issue When Adding Decimal Numbers" due to IEEE 754 floating point standards followed i guess we have a working workaround for this 1.format-number function 2.round function <?444444.70+1034343443404.69?> == > 1034343887849.3899 <?(round((( 444444.70+1034343443404.69))*100) div 100)?> == >1034343887849.39 <?format-number:( 444444.70+1034343443404.69);'D99'?> ==> 1034343887849.39 more info :) Rounding floating-point numbers * Round to Nearest – rounds to the nearest value; if the number falls midway it is rounded to the nearest value with an even (zero) least significant bit, which occurs 50% of the time (in IEEE 754r this mode is called roundTiesToEven to distinguish it from another round-to-nearest mode) * Round toward 0 – directed rounding towards zero * Round toward +∞ – directed rounding towards positive infinity * Round toward −∞ – directed rounding towards negative inf

BIP for-each section

There were lot of threads going the BIP user forum, for resetting the name numbers. thought simple sample would help them to achieve that :) create a sample report as follows. Use the Ms word , option of putting the page number in the MS word page header. then in the page create a simple xml like this, <root> <page> <name> page 1 </name> </page> <page> <name> page 2 </name> </page> <page> <name> page 3 </name> </page> <page> <name> page 4 </name> </page> <page> <name> page 5 </name> </page> </root> use this syntax <?for-each@section:root/page?> <?name?> <?end-for-each?> merge the rtf with the xml, you can notice that, the report contains, 5 pages, with the all pages having the page number as 1. How does that happen ? for-each@section:root/page , this syntax is going to reset the page every time it find a new root/page node. in this exampl

Veera's performance in SAP :)

Total on dynamic columns on group by columns

Got an good question from shahcsanjay who has done the dymanic column , then then got the sum in the horizontal manner, but what he wanted is sum up through the vertical too :) ?for-each-group@cell:current-group()/G_TIME;./TIME? ?sum(current-group()/TV)? ?end for-each-group?, he got struck wiht, i asked his template, after snoozing through that, gave him that loop, which solved it. again a cup of thanks :0 from Sanjay. Opps, i wanted to write all the cases in this blog, but time is not permitting and iam facing similiar issues, daily, got to give a shot, that some generic stuffs like what Tim is delivering there in his Den. hope i will start that soon :)

Calculation In Bip

Post from Sudeep[ i guess i knew this guy :)], If i have this xml <ROOT> <T> <A1>10</A1> <B1>5</B1> </T> <T> <A1>10</A1> <B1>5</B1> </T> <T> <A1>10</A1> <B1>5</B1> </T> </ROOT> i am using this xsl , <?sum(T /A1)?> <?sum(T/B1)?> <?xdoxslt:set_variable($_XDOCTX, ‘TEST’,0)?> <?for-each:T?> <? A1*B1?> <?xdoxslt:set_variable($_XDOCTX, ‘TEST’, xdoxslt:get_variable($_XDOCTX, 'TEST')+(A1*B1))?> <?end for-each?> <? xdoxslt:get_variable($_XDOCTX, 'TEST')?> which will return me the 30 15 50 50 50 150 Got some thanks :) from sudeep too.

Combination of lpad and formatting :)

Recent post, f rom BIP wanted to , format the number to two digits, and then fill the left over space with * and then prepend with$ sign. To format ?format-number(number(10),’###.00’)? ?format-number(number(10.1),’###.00’)? ?format-number(number(10.171),’###.00’)? use this, then to prepend them, if it is one time usage try this ?variable:form_num ;format-number(number(10.171),’###.00’)? ?xdofx:’$’||lpad($form_num,15,'*')? if it is in loop, then ?xdoxslt:set_variable($_XDOCTX, 'x', xdoxslt:lpad(format-number(number(99.171),’###.00’),15,’*’))? $?xdoxslt:get_variable($_XDOCTX, 'x')?