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 August 2nd, 2012, 08:35 AM
Registered User
 
Join Date: Aug 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to compare two different nodes in xmi

Hi i am using XSLT transformation to transform one xmi file to uml file. In my xml files i have two different nodes:
First node:

<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD"
name="Part2"
visibility="public"
aggregation="composite"/>

Second node:

<Profile:AND base_Part="EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DA DD"/>

what i am trying to do is that every time the xmi:id of the uml:property matches with the base_Part of the profile i want to save the base_part valeu. In my xslt transformation i have a transformation class for the owned attribute and there i am trying to compare this two values mentioned above. the comparison i am trying to do is smth like this:

<xsl:if test= "@xmi:id= ´EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD'">
<xsl:sequence
select="fn:createAtt('association','9D13F3CF-4FDB-46bc-B47F-8B4DC9C6DADD')" />
</xsl:if>

Of course with the static values i have putted it works. What i need to know is how to read the base_Part value of the Profile:AND ?

thank you in advance,
 
Old August 3rd, 2012, 12:04 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to bind the Profile:AND element to a variable (say $p) and then you can use test="@xmi:id = $p/base_Part". To bind variables, look up xsl:variable.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare values in different nodes fann XSLT 9 September 11th, 2008 06:25 AM
XML + XSLT Compare Nodes tommyready XSLT 5 September 5th, 2007 03:18 AM
Help with XSLT: xmi:type="{@xmi:type}" (plz help) WallaceHorta XSLT 3 August 18th, 2006 11:23 AM
How to compare nodes from 2 XML docs kwilliams XSLT 0 August 30th, 2005 01:43 PM





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