473,394 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Issue on XSLT by using xml

Hi friends,
I am new to the xslt when i am doing ,I have struck in middle.


Q.As per example:we are having the xml structure like this
<a>
<b>-----</b>
<c>-----</c>
<d>-----</d>
</a>
<a>
<b>-----</b>
<c>-----</c>
<d>-----</d>
</a>
-----------
node <a> may be present more than once.
Loop on <a>

check for <b> and <c>.
If both <b> and <c> present, count occurance of node <a> as 1.
for example if node <a> repeats twice as above,the count should be incremented to 2.

source:xml
software:stylus studio

Real example with the following input:

condition:

Loop over E1EDP01

check if E1EDP01[MENGE] != null && count(E1EDP01/E1EDP05) > 0)

assign the count of the line items that satisfies the above condition

We have a node E1EDP01 which may repeat any no of times,

Inside that we have a condition if E1EDP01[MENGE] != null && count(E1EDP01/E1EDP05) > 0)

If it satisfies this condition then assign the count of the line items that satisfies the above condition

<xsl:for-each select="E1EDP01">

<xsl:if test="MENGE and count(E1EDP05) &gt; 0">

<xsl:value-of select="count(.)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>

<InvoiceTotals>

<TotalLineItems>
<xsl:value-of select="count($Totals)"/>
</TotalLineItems>
We are trying in this way.
Jul 11 '07 #1
4 1977
Dököll
2,364 Expert 2GB
Greetings and welcome!

Please follow this link, I think you will find helpful: http://www.w3schools.com/xsl/xsl_transformation.asp

I will take a look at some options for you. Have a look at the link see what you can gather. Again, welcome...
Jul 12 '07 #2
jkmyoung
2,057 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. <xsl:for-each select="E1EDP01">
  2. <xsl:if test="MENGE and count(E1EDP05) &gt; 0">
  3. <xsl:value-of select="count(.)"/>
  4. </xsl:if>
  5. </xsl:for-each>
This code will give you something like 11111, since count(.) only ever returns 1.
You can then get the length() of the string, but that is rather inelegant.

try instead
<xsl:value-of select="count(E1EDP01[MENGE][E1EDP05])"/>
Jul 12 '07 #3
Expand|Select|Wrap|Line Numbers
  1. <xsl:for-each select="E1EDP01">
  2. <xsl:if test="MENGE and count(E1EDP05) &gt; 0">
  3. <xsl:value-of select="count(.)"/>
  4. </xsl:if>
  5. </xsl:for-each>
This code will give you something like 11111, since count(.) only ever returns 1.
You can then get the length() of the string, but that is rather inelegant.

try instead
<xsl:value-of select="count(E1EDP01[MENGE][E1EDP05])"/>
Hi,
Thanks the thing what u have send is working well.
Jul 13 '07 #4
Dököll
2,364 Expert 2GB
Hi,
Thanks the thing what u have send is working well.
Glad to hear it, have a good one!
Jul 13 '07 #5

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

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
4
by: Gauthier | last post by:
Hi, I've a simple issue with the use of extension objects. I'm trying to call a text formating method from an object that I add to my arguments collection, this method take an input string and...
4
by: Richard L Rosenheim | last post by:
Here's a sample XML file (created by saving a dataset): <?xml version "1.0" standalone="yes"?> <dsData xmlns="http://tempuri.org/DataSchema.xsd"> <Configuration> </Configuration> <Data>...
3
by: Teksure | last post by:
Hi group, searching in the Internet I found two products for XML which incorporate a very robust debugger for XSL/XSLT, I would like you to see these products and then, give me your opinion about...
8
by: C# newbie | last post by:
Hi Group, I have a problem with XML! I have an xml file which starts like this: <Plaftorm PlatformName="empty" PlatformID="1" StyleUsage="URL" xmlns="http://www.domain.com" ...
3
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as...
2
by: bravegag | last post by:
Hi all, I developed a transformation process that works beautifully when tested using MS Internet Explorer i.e. adding the <?xml-stylesheet type="text/xsl" href="../xslt/xmldiffs.xsl"?> on top...
6
by: kenundrum | last post by:
Hey all, I am having an issue with XML/XSLT and JavaScript in my ASP.NET page that I am creating. I first want to apologize if i placed this in the wrong category. Since there were three different...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
4
by: pc.candy | last post by:
Hi there I'm having some difficulty with transforming xml data with more than one namespace defined in the xml. I'm able to bring back some values of the xml but not others in another...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.