XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
phani veeravalliSubject: context to context reference
Author: phani veeravalli
Date: 26 Nov 2005 01:40 PM
As I am novice to the world of xslt technology, I wonder if I can do this.

my xmlstructure is something like this....
<root>
<DocDefinitions>
<AttrDefinition>
<attr attrid='xyz1'>
<value>XML</value>
</attr>
<attr attrid='xyz2'>
<value>XSL</value>
</attr>
<attr attrid='xyz3'>
<value>XSLT</value>
</attr>
</AttrDefinition>
<LocationDefinition>...</LocationDefinition>
<DescriptionDefinition>...</DescriptionDefinition>
</DocDefinitions>
<Docs>
<Doc name='aa'>
<attrvalue>xyz2</attrvalue>
</Doc>
<Doc name='bb'>
<attrvalue>xyz3</attrvalue>
</Doc>
<Doc name='cc'>
<attrvalue>xyz2</attrvalue>
</Doc>
</Docs>
</root>

I am trying select the value of 'attrvalue' for each 'Doc' in <Docs> context and I get it's value, instead I need it's reference value from <attr attrid='xyz1'> which is in different context. Is this feasible?

Help greatly appreciated.

Posttop
(Deleted User) Subject: context to context reference
Author: (Deleted User)
Date: 27 Nov 2005 08:30 PM
Phani,

I don't know exactly what your program looks like, but here is an example.

<output>
{
/root/Docs/Doc[1]/attrvalue,

let $val := /root/Docs/Doc[1]/attrvalue/text()
return /root/DocDefinitions/AttrDefinition/attr[@attrid=$val]/value
}
</output>

The first line "/root/Docs/Doc[1]/attrvalue returns the string "xyz2"
The return statement uses that string to lookup the desired data and returns "XSL"

Does this answer your question?
Clyde

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.