Generate numbers in incremental order, the number of times condition met?
I have tried explaining my problem here also.
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=31&t=007531&p=1
But trying to put in other words now.
I have a NO tag which appears many times in xml. and alwyas have some random numbers displaying.
output looks something similar to this
something......<NO>1</NO>
something......<NO>1</NO>
something......<NO>2</NO>
something......<NO>1</NO>
something......<NO>3</NO>
something......<NO>1</NO>
something......<NO>5</NO>
something......<NO>1</NO>
something......<NO>1</NO>
something...... & so on.
Now instead of these numbers coming in this order i prefer to display in final output file as
1 2 3 4 5 .................... n
Is it possible in any ways using xslt.
DO we need to ignore the values given in input file and then generate output values for same.
it can be like the number of times NO tag appears in xml, it should start from 1 and keep increasing value by 1, until NO tag finishes appearance.
But next time when other xml transforms it again should be able to start from 1 till n.
is there a possibility of using java code for this situation or xslt is capaable enough to handle this.
Thanks
VJ
I'm guessing you are looking for something like this. I used a pull approach but it could be done with a push (xsl:for-each).
Sample XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
<NO>1</NO>
<NO>1</NO>
<NO>2</NO>
<NO>1</NO>
<NO>3</NO>
<NO>1</NO>
<NO>5</NO>
<NO>1</NO>
<NO>1</NO>
</root>
Sample XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
<xsl:template match="root">
<output>
<xsl:apply-templates select="NO"/>
</output>
</xsl:template>
<xsl:template match="NO">
<row>
<xsl:value-of select="position()"/>
</row>
</xsl:template>
</xsl:stylesheet>
Sample Output
<output>
<row>1</row>
<row>2</row>
<row>3</row>
<row>4</row>
<row>5</row>
<row>6</row>
<row>7</row>
<row>8</row>
<row>9</row>
</output>
Similar Messages
-
Is there a way to count the number of times an array moves from positive to negative?
I have an array of values, and I need to find the number of times that the array changes signs (from positive to negative, or vice versa). In other words from a graphical standpoint, how many times a certain line crosses the x-axis. Counting the number of times the array equals zero does not help however, because the array does not always equal exactly zero when it crosses the axis (ie, the points could move from .1 to -.1).
Thanks for you help. Feel free to email me at [email protected] I only have lv 5.1.1 so if you attach any files, they cannot be version 6.0.Attached is a VI showing the # of Pos and Neg numbers in an array, with 0 considered as non-Pos. It is easily modifiable to other parameters - including using the X-axis value as your compare point versus only Zero.
This is a modified VI from LV (Separate Array.vi)
Compare this with your other responses to find the best fit.
Doug
Attachments:
arraysizesposneg.vi 40 KB -
How do i count the number of times a cell has been referenced by other cells' formulae?
Hello,
I have a spreadsheet of recipes and ingredients that use checkboxes to let me know which recipes I can make based on the ingredients I have on-hand, using a formula like this one: =IF(AND('Spirits' :: A42,Mixers :: A18,Mixers :: A41,'Spirits' :: A25 ),Table 3 :: $A$2,Table 3 :: $A$3). If I've checked all of the boxes for ingredients that are required for any one of my recipes, the cell that the formula is in returns something like "YES"; otherwise, it returns a blank. It works well enough, but I'd like to include a cell next to each ingredient with a formula that will look through the hundreds of recipes, which all use a formula like the one above, and return a count of the number of times the ingredient's cell is referenced in those formulas. That way, I'll know which ingredients are the most commonly used in my eclectic collection of recipes. I thought something like =COUNTIF('Recipes' :: A2:A343, "=A2") would work, but it doesn't look at the cell references in the formulas, so no, it doesn't work. Any ideas? I'm using Numbers 2.3Hello
There's no formula to inspect other formula in Numbers. So what you asked cannot be achived in such a way you described.
A simple alternative method would be to build recipe-ingredient matrix as follows.
E.g.
Table definitions:
Recipes
A1 Recipe \ Ingredient
A2 A
A3 B
A4 C
A5 D
A6 E
A7 F
A8 # recipes / ingredient
B1 X1
B2 TRUE
B3 FALSE
B4 TRUE
B5 FALSE
B6 TRUE
B7 FALSE
B8 =COUNTIF(B,TRUE)
C1 X2
C2 TRUE
C3 TRUE
C4 FALSE
C5 TRUE
C6 TRUE
C7 TRUE
C8 =COUNTIF(C,TRUE)
D1 X3
D2 FALSE
D3 TRUE
D4 FALSE
D5 TRUE
D6 FALSE
D7 TRUE
D8 =COUNTIF(D,TR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3
A5 X4
B1 in-stock?
B2 TRUE
B3 TRUE
B4 TRUE
B5 FALSE
C1 code
C2 =IF(B2,1,0)
C3 =IF(B3,1,0)
C4 =IF(B4,1,0)
C5 =IF(B5,1,0)
Y
A1 Ingredient
A2 Y1
A3 Y2
A4 Y3
A5 Y4
B1 in-stock?
B2 TRUE
B3 FALSE
B4 TRUE
B5 FALSE
C1 code
C2 =IF(B2,1,0)
C3 =IF(B3,1,0)
C4 =IF(B4,1,0)
C5 =IF(B5,1,0)
In "Recipe" table, the first row is header row and the last row is footer row.
Hope this may help,
H -
How to find the number of times method being called.....
hi,
can any one pls tell me how to find the number of times the method being called......herez the example....
Refrence ref = new Refrence();
for(int i = 0;i < arr.length; i++){
if(somecondition){
ref.getMethod();
here i want to know how many times the getMethod() is calling...Is there any method to do this.. i have seen StrackTraceElement class..but not sure about that....pls tell me the solution....can any one pls tell me how to find the number of times the method being called......
herez the example.... http://www.catb.org/~esr/faqs/smart-questions.html#writewell
How To Ask Questions The Smart Way
Eric Steven Raymond
Rick Moen
Write in clear, grammatical, correctly-spelled language
We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal ? in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes. -
How to calculate the number of times an user has accesed a BEx report
Hi Experts,
We have number of reports in our BW portal and users logon to the portal and run the reports.
How do we count the number of times each user has logged in and ran each report.
Kindly advice.
Thanks,
SaiHi Sai:
I think you can use BI statistics information, which could provide you more detail information.
You can follow the document
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/90080703-4331-2a10-cd98-9c1e95acdea0
Regards,
Louis Lu -
How do I count the number of times a word appears in a column?
What I have is a spreadsheet logging work history. Let's say the work location is "office", "home", or "travel" and I want to have a separate cell in another table for totals, count up the number of time each appears in the data for the year. So it would look like this:
Date
Location
sept 1
office
sept 2
home
sept 3
home
sept 4
travel
sept 5
office
sept 6
office
sept 7
office
sept 8
travel
sept 9
home
sept 10
office
Totals
Days
10
Office
5
Home
3
Travel
2
I just can't figure out how to develop the formula to put in the Totals column to make it work this way. If you can help me achieve this I'd really appreciate it!Hi SpartanAntarctican,
Table 1 to record your locations
Date
Location
sept 1
office
sept 2
home
sept 3
home
sept 4
travel
sept 5
office
sept 6
office
sept 7
office
sept 8
travel
sept 9
home
sept 10
office
Table 2 to sum your locations
Totals
Days
10
Office
5
Home
3
Travel
2
In Table 2 the formula in B2
=ROWS(Table 1::A)−1
Minus 1 because there is a Header Row in Table 1.
In Table 2 the formula in B3 (and Fill Down)
=COUNTIF(Table 1::B,A3)
You can check this by adding 5 + 3 + 2 to arrive at 10
Or maybe delete Row 2 put the Days calculation into a Footer Row in Table 2
=SUM(B) .
Regards,
Ian. -
How Do I Assess The Number Of Times A Page Has Been Hit?
Can anyone identify the schema, table and field that when queried identify the number of times an individual page has been accessed?
I want to create a 'hit counter'. Ideally the field would identify all accesses, not by IP address or username or any other denominator.portal30.wwlog_activity_logs
Portal logs activity in two tables wwlog_activity_log1 and wwlog_activity_log2. It toggles between these two tables every week by default. The wwlog_activity_logs is a view connecting both of these tables.
Be prepared to do some homework to figure out how to identify the actual page(s) you want to log. It's not clear cut and also be aware that you can't get down to the actual tab pressed within a page without some custom coding... and also, portal purges logged data every two weeks by default. -
Calculate the number of times a character appears in a string
Please help.
Is there a way to count a number of occurences of a particular character in a string? e.g. If you have 'DATABASE' as a string, can you calculate the number of times 'A' occurs in it? The answer is supposed to be 3, but can you calculate it in Oracle?
Thanks in advance.Re: Any built-ins for occurance
-
How can I increase the number of times my 4s rings before it goes 2 msg bank?
My iphone 4s only rings 3 times before it goes to msg bank. How Can I increase the number of times it rings?
This is controlled by your carrier, so contact them,
-
How can I increase the number of times I am notified that I have a text or voicemail .
How can I increase the number of times I am notified that I have text or voicemail waiting to be read?.
DPickRN,
Making sure you don't miss any messages is very important and we would be happy to go over your options today. Are you using the Visual voicemail or do you call *86 to access your voicemails?
CandiceH_VZW
Follow us on Twitter @VZWSupport
If my response answered your question please click the �Correct Answer� button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!! -
HT1689 How can I extend the number of times my phone rings before going to answerphone
How can I extend the number of times my Iphone 4s rings before it goes to answerphone
Call you carrier and ask them how you can change this. The number of rings before voicemail kicks in is set by your carrier. Some have the option to do it from your phone if you know the sequence of codes to send, but you need to ask your own carrier how to do it for their system.
-
Why is there a limit on the number of times a "DVD player region" can be changed, and can this numbert be adjusted for more region changes, or an indefinite number of region changes?
Region encoding is the mechanism that enables motion picture studios to control the worldwide release of their movies. It is required by the DVD Forum (http://www.dvdforum.org/forum.shtml) in all commercial hardware DVD players. Every DVD-Video disc contains one byte of data representing a region code, which limits where the disc can be played.
http://support.apple.com/kb/HT2397
Once you have set the region in DVD Player five times it cannot be changed.
Instead, use VLC to view videos from different regions:
http://www.videolan.org/vlc/download-macosx.html -
Is there any way to limit the number of times that a PDF can be opened?
I run a small publishing company and we want to provide exam copies of our books to professors. At present our exam copies have the words EXAM COPY as a water mark on every page and we've also made the files so that they can't be printed or easily copied. However, we'd like to also restrict these PDFs so that they can only be opened 5 times. I've read about FileOpen but that approach seems a bit more complex than needed. Is there any other way to restrict the number of times that a PDF file can be opened once it is downloaded? Thanks in advance for any suggestions.
DRM soltions like FileOpen are your best bet for PDFs. Others include Adobe's LiveCycle Rights Managment, LockLizard, Armjisoft PDF Security OwnerGuard, etc.
They all work and are priced differently, but there's really nothing for what you want to do that is both simpler and secure. -
Count the number of times a character is in a string using pl/sql
I need to count the number of times ":" appers in the string ":XXX:CCC:BBB:".
I have sound some solution using SQL but I do not want the context switch.
Also I am on 10g so I can not use REGEXP_COUNT.
Any help would be great.Hi,
length(REGEXP_REPLACE(':XXX:CCC:BBB:','[[:alnum:]]'))counts all kinds of punctuation, spaces, etc., not just colons. Change any (or all) of the colons to periods and it will still return 4. Use '[^:]' instead of '[[:alnum:]]' if you really want to count just colons.
Also, "SELECT ... FROM dual" is usually needed only in SQL*Plus or similar front end tools. In PL/SQL, you can call functions without a query, like this:
x := NVL (LENGTH (REGEXP_REPLACE (txt, '[^:]')), 0); -
Get the following error from Oracle
ORA-24333: zero iteration count
Cause: An iteration count of zero was specified for the statement
Action: Specify the number of times this statement must be executed
Any suggestions on whether is this a Oracle bug or if not what should be set to avoid this failure.Hello get this from executing the following.
Occurs intermitently.
select MAX(LENGTH(lxVal)) from lxString_74501fb6 where lxType=910231053
Find the MaxLenght(LxVal) returned is null for this query.
Did google it but says the iterator not initialized. But not the case here
Thanks
Maybe you are looking for
-
Did you know? (ATV power consumption)
leaving your Apple TV connected to a power source when not in use will cost you $7.65 a month in hydro cost (based on prices for Hydro in Vancouver Canada. I am testing the consumption through our Hydro smart panel at home and will post the results a
-
Hello i got a problem. i maby being ahaed on this becous i am studing dreamweaver ant flash. but here it is I have made a webside. When i desided that i whantet a logo flash on every page i got. So i put the flash on my template page but when i look
-
Why does my iPad keep moving between screens and shaking?
Why does my iPad keep shaking and/ or move between apps?
-
RFC: Meaning of program-ID ?
Hello everybody, what is the program-id? Does the name of the program-id has to meet special requirements? Background: I have to maintain a RFC destination (tcp/ip) for rfc-sender to XI. Regards Mario
-
Failed to load SyncUICoreLocaliZed.dll
When first syching my iPhone or ipad after first opening of iTunes (eg following reboot) I receive a message stating 'failed to load SyncUICoreLocaliZed.dll' what does this mean? it does not appear to cause any issues at present.