472,984 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Showing node-level members of a global set

ion
Hi! I'm struggling with doing this in an elegant way -- I'll get my
XSLT books out of storage this weekend, but for now I could use some
help.
<bedknob>
<broomstick>
<bippity>boppity</bippity>
</broomstick>
<broomstick>
<bippity>boppity</bippity>
<bippity>boo</bippity>
</broomstick>
</bedknob>
I'd like to get the complete list of bippities, then compare the
bippities of each broomstick to them, and make a mark for each present
member of the complete set of bippities in a particular broomstick,
like
<table>
<thead>
<tr>
<th>boppity
</th>
<th>boo
</th>
</tr>
</thead>
<tbody>
<tr>
<td>X
</td>
<td>
</td>
</tr>
<tr>
<td>X
</td>
<td>X
</td>
</tr>
</tbody>
</table>

OK. So, I use a Muenchian sort to get the unique list of bippities for
the thead element, but then to do the rows in the body, I have to go
through it again, and check each member against the set of present
values. I'm thinking of something like taking the intersection and
looking for count() = 2, but I'm having trouble making it happen.

Can you help me?

Ion

Jun 2 '06 #1
2 1060
Hi,

On Fri, 02 Jun 2006 21:54:32 +0200, ion <io********@gmail.com> wrote:
Hi! I'm struggling with doing this in an elegant wayI'd like to get the
complete list of bippities, then compare the
bippities of each broomstick to them, and make a mark for each present
member of the complete set of bippities in a particular broomstick,
like

I have no idea if this will conform to your idea of elegance (it uses
plain dumb for-each loops), but this solution seems to work:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:key name="b" match="bippity" use="."/>
<xsl:variable name="bip"
select="//*[generate-id()=generate-id(key('b',.)[1])]"/>

<xsl:template match="bedknob">
<table>
<thead>
<tr>
<xsl:for-each select="$bip">
<th><xsl:value-of select="."/></th>
</xsl:for-each>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="broomstick"/>
</tbody>
</table>
</xsl:template>

<xsl:template match="broomstick">
<xsl:variable name="this" select="bippity"/>
<tr>
<xsl:for-each select="$bip">
<td>
<xsl:if test=".=$this">X</xsl:if>
</td>
</xsl:for-each>
</tr>
</xsl:template>

</xsl:stylesheet>
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Veni, vidi, wiki (http://www.wikipedia.org)
Jun 3 '06 #2
ion
Thanks, Joris, that works great.
Ion

Joris Gillis wrote:
Hi,

On Fri, 02 Jun 2006 21:54:32 +0200, ion <io********@gmail.com> wrote:
Hi! I'm struggling with doing this in an elegant wayI'd like to get the
complete list of bippities, then compare the
bippities of each broomstick to them, and make a mark for each present
member of the complete set of bippities in a particular broomstick,
like

I have no idea if this will conform to your idea of elegance (it uses
plain dumb for-each loops), but this solution seems to work:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:key name="b" match="bippity" use="."/>
<xsl:variable name="bip"
select="//*[generate-id()=generate-id(key('b',.)[1])]"/>

<xsl:template match="bedknob">
<table>
<thead>
<tr>
<xsl:for-each select="$bip">
<th><xsl:value-of select="."/></th>
</xsl:for-each>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="broomstick"/>
</tbody>
</table>
</xsl:template>

<xsl:template match="broomstick">
<xsl:variable name="this" select="bippity"/>
<tr>
<xsl:for-each select="$bip">
<td>
<xsl:if test=".=$this">X</xsl:if>
</td>
</xsl:for-each>
</tr>
</xsl:template>

</xsl:stylesheet>
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Veni, vidi, wiki (http://www.wikipedia.org)


Jun 5 '06 #3

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

Similar topics

0
by: Dimitre Novatchev | last post by:
You seem to be unaware of the xslt processing which uses the built-in rules in the absence of templates that match some selected node. http://www.w3.org/TR/xslt#built-in-rule According to the...
2
by: Allan | last post by:
Hi All, I am having a problem parsing an xml file I am getting from another server. This is the portion of the xml I am getting I am interested in: <DestinationAddress> <City>Leawood</City>...
3
by: Tom | last post by:
Sorry... new to this. I trying to figure out how to do a page redirect when someone clicks a treeview node. Does someone have a code snippet for this?
2
by: K B | last post by:
Hi, Very strange problem. I have an asp.net 2.0 treeview and populating it from an xml file. All works great, except when I update a node and rebind the control. I can see the updated node in the...
0
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User...
1
by: daz_oldham | last post by:
Hi everyone Has anyone idea what would cause a TreeViewControl to show only the root node if I am using a bog-standard .sitemap file? Many thanks Darren
3
by: luthriaajay | last post by:
Why is my xpath giving null for the the flwg <Configuration> <Listener.Whiteboard> <AQListener> <Product>A</Product> <Message.Class>XMLMessage</Message.Class> <Database> ...
10
by: npm | last post by:
Hi, I've set up some basic xlinks, just like on the w3 tutorial, but they're not showing up in a browser (IE6 or FF2). Anybody know why? Do they only work when used w/XSL? I'm so confused why they...
0
by: tweakmy | last post by:
Hi to all expert, ladies coders and gentlemen coders, I m quite newbie in this. I just started vb.net not long ago..because i was too crazy bout making an application for my own phone. as for now, i...
12
by: Arcticool | last post by:
Can anyone tell me why j never shows up in my locals window? 32 is printed to console so I know the assignment is working. I was under the impression that I could see everything as it happens by...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.