Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2004, 10:56 AM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with complex xpath

I'm new to XSLT, and although I think I've mastered the basics I am completely stuck with the following problem. Help would be much appreciated!

Consider the following XML:

<Document>
    <Class name="A">
        <Attr name="x" type="String"/>
        <Attr name="y" type="Integer"/>
        <Attr name="z" type="Double"/>
    </Class>
    <Class name="B">
        <Attr name="p" type="String"/>
        <Attr name="q" type="String"/>
    </Class>
    <Object type="A">
        <AttrValue value="string1"/>
        <AttrValue value="10"/>
        <AttrValue value="3.14"/>
    </Object>
    <Object type="A">
        <AttrValue value="string2"/>
        <AttrValue value="20"/>
        <AttrValue value="2.71"/>
    </Object>
    <Object type="B">
        <AttrValue value="string3"/>
        <AttrValue value="string4"/>
    </Object>
</Document>

The rule is that Class/Attr[x] is associated with Object/AttrValue[x].

What is the xpath expression that would give me a node list of all AttrValue/@value whose corresponding Attr/@type = 'String'. Ie. the results for the above example would be string1 | string2 | string3 | string4

Is this possible? Thanks for your time.

 
Old February 25th, 2004, 04:33 AM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This not possible then?

I've achieved the desired result using a template, but if doesn't feel right.

Cheers.






Similar Threads
Thread Thread Starter Forum Replies Last Post
complex query g_vamsi_krish SQL Language 3 February 27th, 2006 10:48 AM
Complex How To In XSLT Wee Bubba XSLT 2 April 8th, 2005 07:16 AM
Complex Dataviews Alaric ADO.NET 0 October 16th, 2003 07:56 AM
query too complex [email protected] Access 3 August 28th, 2003 09:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.