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
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Danny CostaSubject: External lookup list
Author: Danny Costa
Date: 10 Jun 2009 05:03 AM
Hi,

I'm a very green newbie. I need to create a XSLT transformation.
My source XML will have a code & I need to lookup the description. The codes and descriptions are in an external XML file which looks like

<Inventory>
<row Aux2="52438231" Partno="ABC123"/>
<row Aux2="9400581022940" Partno="TEL234"/>
<row Aux2="9400581020113" Partno="I45JU66HH"/>
<row Aux2="9400581018547" Partno="QWEERTY55"/>
</Inventory>

The source contains the Aux2 value & I need to return the Partno.

It is exactly like the Lookup List already available in Sytlus Studio but my list is in an external XML file, formatted like above (much longer!).

Thanks for your help in advance.

Postnext
Tony LavinioSubject: External lookup list
Author: Tony Lavinio
Date: 10 Jun 2009 04:15 PM
If the key is in $key, then to look up you could do something like

<xsl:value-of select="doc('file:///c:/inventory.xml')/Inventory/row[@Aux2 = $key]/@Partno"/>

If you're looking up things often, you might want to use xsl:key.

Postnext
Danny CostaSubject: External lookup list
Author: Danny Costa
Date: 10 Jun 2009 06:42 PM
Thanks, but that suggestion gave me an error
xsl:template match="/" ...in Untitled1.xsl (line 22)

How would I use the xsl:key?

Would it be easier if I gave you a source xsd & xml sample, plus the target xsd and the lookup xml?

Postnext
Tony LavinioSubject: External lookup list
Author: Tony Lavinio
Date: 11 Jun 2009 09:47 AM
If it's small, yes. :)

Postnext
Danny CostaSubject: External lookup list
Author: Danny Costa
Date: 11 Jun 2009 07:37 PM
Attached is the source - both a xsd and a sample xml file.
I've also included the target xsd and a sample lookup file.
Also is a image of the mapper showing kinda what I'm after. I think it's really simple for an expert but this newbie has been struggling for about a week on this!

Thanks for your help.


UnknownStylusSample.zip
zipped files

Postnext
Danny CostaSubject: External lookup list
Author: Danny Costa
Date: 16 Jun 2009 02:31 AM
Tony,

I know you're probably flat chat but have you had the chance to look at the attachment from my earlier post above? I'm getting really desperate.

I reckon it must be so easy for a XML guru, but I've just wasted another day trying to nut it out myself. Help!

Anyone else?

Postnext
Tony LavinioSubject: External lookup list
Author: Tony Lavinio
Date: 16 Jun 2009 10:31 AM
Try this.


UnknownUntitled2(2).xsl

Posttop
Danny CostaSubject: External lookup list
Author: Danny Costa
Date: 16 Jun 2009 10:36 PM
Woo hoo! That seems to work well!

I just needed to include a for-each loop & work out the correct syntax for dealing with that.

I now have a problem in that the software which calls the translation does not have the EnableDocumentFunction set, so I'm getting an error from the software that Document() function was prohibited. Anyway, the xsl is actually working. To me that's a pretty big milestone.

Thanks so much for your help.

 
Topic Page 1 2 3 4 5 6 7 8 9 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.