Jump to content

How To Do A Chain Operation In Xslt


Krishn60
 Share

Recommended Posts

I have a requirement to do a chain operation between 2 XML files and to take an attribute from the 2nd XML file. Please tell me what xsl: function to use. and how to do that. Great, if it is with an example.Here is my first XML file- <Animinations> - <AnimationProto Length=45 Performance="Dilute" - <AnimationsDone> <AnimationOrderRec RecNumEXT="264" /> - </Animations Done>- <Animations>Here is my 2nd XML file- <Cartoons> -<PicturesProfiles Name="Durrel", RecNumExtn="263" Bolondr="Windows"/> -<PicturesProfiles = "Volkrtrn", RecNumExtn="3348" Bolondr="Zilloper"/>- </Cartoons>I need to extract the "Name" attribute from the 2nd file by chaining the RecNumEXT of the first file with the RecNumExtn in the 2nd file. Please let me know.Thanks

Link to comment
Share on other sites

You can use the document() XSLT function to select something from the second XML.For example:

<xsl:template match="AnimationOrderRec"><xsl:value-of select="document('second.xml')//PicturesProfiles[@RecNumExtn=string(current()/@RecNumEXT)]/@Name" /></xsl:template>

Should get the Name attribute of the PicturesProfiles element that has an RecNumExtn attribute like the currently selected AnimationOrderRec element (AnimationOrderRec belonging in the first document in this case).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...