Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - dynamic database processing >Thread Next - Re: dynamic database processing Re: dynamic database processingTo: NULL Date: 9/5/2004 2:31:00 PM Thomas Mann wrote: > I have a xml-database with a changing amount of elements <A>. How do I write > a XSLT-Script to find out how many elements <A> are inside the database in > order to write them to an output file ? This problem is so simple that you don't need XSLT for it. Here is a script in xmlgawk (tested): BEGIN { XMLMODE=1 } XMLSTARTELEM == "A" { inA=1; count ++ } XMLENDELEM == "A" { inA=0 } XMLCHARDATA && inA { print "element:", $0 } END { print "There are", count, "elements A" } The script counts elements "A" and prints each of them to standard output. > example: > > <A> P0 </A> > <A> P1 </A> > ... > <A> Pn </A> The result for this example is: element: P0 element: P1 element: Pn There are 3 elements A | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
