Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Re: trying to build an xpath query...

Thread Tools

Re: trying to build an xpath query...

Michael Dahlquist
Posts: n/a
Marrow -

This helps a ton. Perfect. Of course my example didn't end up being
quite accurate, but that just meant I had to figure the rest out on my
own. It's better that way. Thanks for your help -


But if you want to include the skipped <b> elements as being those that
part of the preceding <b> with a 'marker-' then you need to tweak the
key a
bit too, e.g.

== XSL2 =====================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xslutput method="html" indent="yes"/>
<xsl:key name="kBGrouped" match="a/*[not(self::b) or

<xsl:template match="a">
<xsl:apply-templates select="b[m/@id[starts-with(.,'marker-')]]"/>

<xsl:template match="b">
<xsl:text>B title: </xsl:text>
<xsl:value-of select="."/>
<!-- now do all the elements following this <b> -->
<xsl:apply-templates select="key('kBGrouped',generate-id())"

<xsl:template match="*" mode="after-b">
<xsl:text>Element: </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text> (</xsl:text>
<xsl:value-of select="."/>
<!-- if you want to process the children of the elements -->
<!-- following the <b> then do an <xsl:apply-templates> -->
<!-- here and provide templates for them. -->
== end of XSL2 ==============================

Hope this helps
Marrow - home of Xselerator (XSLT IDE and debugger)

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Memory leak" in javax.xml.xpath.XPath Marvin_123456 Java 4 07-29-2005 03:49 PM
SWsoft Acronis Disk Director Suite 9.0 Build 508, Acronis OS Selector 8.0 Build 917, Acronis Partition Expert 2003 Build 292, Acronis Power Utilities 2004 Build 502, F-SECURE.ANTI vIRUS.PROXY v1.10.17.WINALL, F-SECURE.ANTI vIRUS v5.50.10260 for CITRI vvcd Computer Support 0 09-25-2004 01:38 AM
Problem selecting a node with XPATH if attribute value contains backslashes - how to force XPATH string to be treated as literal? Alastair Cameron XML 1 07-08-2003 07:24 PM
Re: trying to build an xpath query... Michael Dahlquist XML 0 07-07-2003 02:37 PM
trying to build an xpath query... Michael Dahlquist XML 0 07-01-2003 08:21 PM