473,657 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT question

Can anyone help me. I need to process groups of elements and their children
nodes very high on the template stack. Is it possible?

:::Source XML document:::
<root xmlns="urn:temp uri.org">
<child>
<!-- many children nodes here -->
</child>
<child>
<!-- many children nodes here -->
</child>
<child>
<!-- many children nodes here -->
</child>
<child>
<!-- many children nodes here -->
</child>
</root>

:::Resulting Tranformed XML document:::
<root xmlns="uri:some other.org">
<group>
<!-- and some children nodes -->
</group>
<group>
<!-- and some children nodes -->
</group>
</root>

Jul 20 '05 #1
4 2041
* Mike King wrote in comp.text.xml:
Can anyone help me. I need to process groups of elements and their children
nodes very high on the template stack. Is it possible?


Yes, searching for Grouping and XSLT using Google should help. I can't
work out from your example what the pattern for grouping should be, so
I can't provide example code...
Jul 20 '05 #2
> Yes, searching for Grouping and XSLT using Google should help. I can't
work out from your example what the pattern for grouping should be, so
I can't provide example code...


I have searched an haven't found the solution yet. Maybe it would help if I
provide more information. I'm trying to produce a PDF document. I have
written an application that will take a XML document as an input and produce
a PDF document based on that document. The problem I'm having is the XML
structure that I have chosen requires that each sheet be represented as an
<sheet> element. So here's a sample document that represents that PDF
document:

<sheets>
<sheet>
<table>
<column>
<cell>some text</cell>
</column>
</table>
</sheet>
</sheets>

The problem is I want to take ten or some other number of test-results
elements and group them together on one sheet and then another ten or so on
the next sheet and so on. Here's an example of a XML document where I'm
trying to group the Test Results on a sheet.

::: Source document:::
<root>
<test-results title="some title" date-time="2004-01-01 01:01:00">
<start-up-time passed="true">
<spec min="1" max="4" />
<results>2.31 </results>
</start-up-time>
<!-- many other tests -->
</test-results>
<test-results>
<start-up-time passed="true">
<spec min="1" max="4" />
<results>2.64 </results>
</start-up-time>
<!-- many other tests -->
</test-results>
<!-- many other test results -->
</root>

:::Resultant document:::
<sheets>
<sheet>
<table>
<column>
<cell>Start Up Time</cell>
</column>
<column>
<cell>2.31</cell>
</column>
<column>
<cell>2.64</cell>
</column>
</table>
</sheet>
</sheets>
Jul 20 '05 #3
The problem is I want to take ten or some other number of test-results
elements and group them together on one sheet and then another ten or so on
the next sheet and so on.


<xsl:variable name="n" select="10"/>

<xsl:for-each select="test-results[position() mod $n = 1]">
<sheet>
.... whatever ...
<xsl:apply-templates
select=".|follo wing-sibling::test-results[position() &lt; $n]"/>
.... whatever ...

</sheet>
</xsl:for-each>

David
Jul 20 '05 #4
Thank you very much!! You enabled me to meet my deadline - thank you.

I was trying something similar but I couldn't get it to work.
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2119
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content provider who says we need to use XSLT and Web Services to pull the content from their site. Can someone give me a nutshell definition on how this works??? We use Cold Fusion MX on our web server, but I'm having trouble finding a
0
2344
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag, such as a div with a runat=server. I can somewhat do this if I create a server control and include the control within the html div tag but this method (borrowed from ASP.NET Website Programming by Wrox press thanks guys) does not give me the full...
3
3082
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION> <OPTION>3<OPTION> </FIELD>
0
3293
by: DAnne | last post by:
Hi, I'm very new to xslt and this is my first time posting to a Forum so please forgive me if I transgress any protocols. I have to do a tally report. This report is divided up into sections. Each section has a list of questions. Each question has responses. I need to display a list of responses to the questions (i.e. set:distinct), once and only once, each section. My second problem is that these questions can also have corrective...
18
2066
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1 and A2 and feature B depends on B1 and B2. And write that to a text file.
15
2154
by: Jeff Uchtman | last post by:
Can I draw from 2 XML sources, the structure is exactly the same execpt for data contained into 1 xslt using math to add some structrure, and displaying others as node 1 and node 2? This data is XML from a Barracuda Spam server that has grown to 2. Here is a snip from my form draw. Imports System Imports System.IO Imports System.Net
2
1280
by: MichaelRKramer | last post by:
Hi, I'm new to dotnet 2.0, but I'm an expert in asp 3 or classic asp. Most of my sites are all done with XSLT and ASP which basically writes XMLs. Now I'm reading about the new cool stuff in visual studio 2005. How does VS 2005 or .net 2.0 work with XSLT's? Is what I've been doing the best practice or a dumb ass move? Will I not be using power of 2.0? Lost programmer
14
5139
by: Lee | last post by:
I have a xml file, here is sample part: <?xml version="1.0" encoding="UTF-8"?> <ProducsList> <Product id="1"> <SpecList> <Spec> <SpecLabel>Height</SpecLabel> <SpecValue>10</SpecValue> <SpecCat>Dimension</SpecCat> </Spec>
1
1297
by: nayijitu | last post by:
Hi, I need some thing like this. I have an XML file and it contain some elements(tag) with a proper hierarchy... In that XML a particular element <page> contain some child node element like below ..... <page> <Question></Question> <Question></Question>
2
2499
by: astroboiii | last post by:
New to the whole xml thing and finding w3schools to be an excellent resource. Now down to my question: I have several xml files I need to parse through and grab relevant information from and produce a new xml file. This needs to be automated through ant. The ant script is working fine, and I am usign the <transform> function to use my xslt file and go through all the required xml files, parse them, style them, and ultimately generate my...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.