Searching folder for a specific XML file using XSLT
I have a folder with multiple XML files and all of them have the same
structure, with different attribute values.
File1.Xml
<Parent attribtueValue="A">
<Child>
<Data1>grape</Data1>
<Data2>sour</Data2>
</Child>
</Parent>
File2.Xml
<Parent attribtueValue="B">
<Child>
<Data1>apple</Data1>
<Data2>sweet</Data2>
</Child>
</Parent>
I have a different Xml (tree.xml) that looks like this:
<Tree>
<Branch></Branch>
<attributeValue>B</attributeValue>
</Tree>
I am doing an XSLT transform to transform tree.xml to look like this:
<Tree>
<Branch></Branch>
<Data1>apple</Data1>
<Data2>sweet</Data2>
</Tree>
Now, the transformation works fine if I take one particular document from
the folder as
<xsl:variable name="file" select="'C:\docs\file2.xml'"/>
<xsl:variable name="info" select="document($file)/Parent/Child/."/>
I want to be able to take the folder as a parameter input, and loop
through to find the right xml, through attributeValue, and use the Data
within that to transform my tree.xml. I am new to XSLT and I can't find
any help with this in the limited research that I've done so far.
Any help is appreciated. Thanks.
No comments:
Post a Comment