I know its redundant but thats what this report calls for.
For every node except the first, I want to output a pair of nodes: the
current and prev one.
For sake of example, lets call the node <qsales> Quarterly Sales. (and
includes children)
If I could use an array syntax, it would be:
<qsales>[1]
<qsales>[2]
<qsales>[2]
<qsales>[3]
<qsales>[3]
<qsales>[4]
So I'm playing with preceding-sibling and hoping PHP5 is using XSLT
2.0 ie: max()
libxslt Version 1.1.7 phpinfo() notes
libxslt compiled against libxml Version 2.6.11 phpinfo() notes
Actually, doing some CL tests on WinXP, using jdk1.4.0
I'll have to research to find out what lib is being used there.
right now, I'm using a sort and then attempting something like this
(psuedo-code)
<xsl:variable name="ndx" select="positio n()" /> // having problems
defining var in root template
call-template <xsl:with-param name="node" select="." />
call-template <xsl:with-param name="node"
select="../qsales[position()=$ndx-1]" />
Another alternative, as I brainstorm
could I find the max() position() of preceding-sibling ?
One of the children of the nodes, is actually an index, but I'm
doubtful I can use it
Select node where <qsales>.inde x = 3 then use call-template
Re: Outputting Pairs - can I get a little help ? 1 1210
awebguynow wrote: I know its redundant but thats what this report calls for. For every node except the first, I want to output a pair of nodes: the current and prev one. For sake of example, lets call the node <qsales> Quarterly Sales. (and includes children)
If I could use an array syntax, it would be: <qsales>[1] <qsales>[2]
<qsales>[2] <qsales>[3]
<qsales>[3] <qsales>[4]
So I'm playing with preceding-sibling
<xsl:if test="position( )>1">
<xsl:value-of select="precedi ng-sibling::qsales[1]"/>
</xsl:if>
A numeric abbreviated predicate on a 'preceding' axis counts backwards
from the context node, so [1] here means the immediately preceding
element node of the given type.
///Peter
--
XML FAQ: http://xml.silmaril.ie/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Francis Hwang |
last post by:
Hi,
Maybe this is a newbie question, but: Is there a way to output an
element's contents -- including contained nodes and free-form text --
without the containing tags?
I can imagine that this request might be against the spirit of XML in
general, but the reason I'm trying to do this is that I want to use
XSLT for simple generation of XHTML. Basically I want the page's
contents in external files, then I want to include them into a...
|
by: Chris Bedford |
last post by:
Hi:
this question has been driving me crazy. would be grateful for any
help.
I am writing a version of the identity transformation to filter some
documents (they happen to be wsdl docs).
My problem is that for just about every element in the
output document all of the namespace defintions defined in my top
|
by: David Dorward |
last post by:
I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.
Does anyone know of a nice prewritten one?
--
David Dorward <http://dorward.me.uk/>
|
by: Evan |
last post by:
Is there a simple way to to identify and remove matching pairs from 2
lists?
For example:
I have
a=
b=
|
by: Arjen |
last post by:
Hi,
I have this string:
private string pairs = { "AB", "CD", "BD", "AC", "BC", "AD", "AB", "CD" };
Now I want to randomize all pairs, like the first AB to BA.
for (int i = 0; i < 8; i++)
{
string pair = pairs;
| |
by: Peter Nimmo |
last post by:
Hi,
I am writting a windows application that I want to be able to act as if
it where a Console application in certain circumstances, such as error
logging.
Whilst I have nearly got it, it doesn't seem to write to the screen in
the way I would expect.
The output is:
|
by: Alan Isaac |
last post by:
I want to generate sequential pairs from a list.
Here is a way::
from itertools import izip, islice
for x12 in izip(islice(x,0,None,2),islice(x,1,None,2)):
print x12
(Of course the print statement is just illustrative.)
What is the fastest way? (Ignore the import time.)
|
by: mcjason |
last post by:
I saw something interesting about a grid pair puzzle problem that
it looks like a machine when you find each that work out the way it
does and say with all the others that work out the way they do
together overlapping common pieces but say connected each working out
as connected, but together as connected it's connected with the others
connected. a whole machine where connected together is a condition of
the machine together as...
|
by: Ebenezer |
last post by:
Let's suppose I have some nodes in an XML file, with an URL attribute:
<node url="mypage.php?name1=value1&foo=bar&foo2=bar2&name2=value0" />
<node url="myotherpage.php?name4=value4&foo=bar3&foo2=bar5&name2=value8" />
and so on.
Let's suppose I want to retrieve this @url parameter, BUT ONLY with the
values, in querystring, associated with "foo" and "foo2" (thus
discarding name1, name2, name4 and every other different ones).
|
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,...
|
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...
| |
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |