[RESOLVED] Accessing another xml file from within xsl:for-each
:wave:
This problem is even worse than the last thread.
So here's the situation. I have this xml table with all the potential attributes for a given facility. One of those attributes is the type_code. Based upon a facility's type_code, I have to display the attributes from the table that apply to that facility. So as I'm going through the records in the table, I only want to display the attributes that apply to that facility's type_code - not all the attributes in the table.
So I have to look up the list of attributes that apply to the facility's type_code. But that list is in another xml file from the one I'm parsing with my xsl file. Is it possible to reference another xml file and get data out of it using a parameter from my for-each loop?
This xsl stuff is new to me and I'm stumbling around feeling pretty noobish right now. :ehh:
Re: Accessing another xml file from within xsl:for-each
It is possible to do what you are attempting to achieve. I wish there was a chunk of your code. However, take a look at the Zvon website
http://zvon.org/xxl/XSLTutorial/Books/Book1/index.html for possible solutions in their tutorials' sections.
Hope that helps.
Re: Accessing another xml file from within xsl:for-each
I would combine both xml files before sending it to the xsl
Re: Accessing another xml file from within xsl:for-each
Thanks for that info, Mark. I was starting to think that was the case.
Re: [RESOLVED] Accessing another xml file from within xsl:for-each
I think you are stretching what is practical to do with XSL — perhaps you would be better off loading the files into an XML database?
Re: [RESOLVED] Accessing another xml file from within xsl:for-each
Here's an example that I found that is being used by another developer on our team:
Code:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="es_related_report.xsl"?>
<!DOCTYPE es_related_codes
[
<!ENTITY related_codes SYSTEM "../qde_related_codes.xml" >
<!ENTITY type_codes SYSTEM "../typecodes.xml" >
<!ENTITY criteria SYSTEM "../qde_criteria.xml" >
]
>
<es_related_codes>
&related_codes;
&type_codes;
&criteria;
</es_related_codes>
The xsl file references this xml file, which is actually a combination of three other files, as I understand it. So I'm trying to do a similar thing myself, but I'm having issues. I may have to post a thread about that later. ;)
Re: [RESOLVED] Accessing another xml file from within xsl:for-each
OK. I posted a new thread about the issues I'm having loading the new document. If you're interested you can look here:
http://www.vbforums.com/showthread.p...ading-xml-file
Thanks for the assistance, folks. :)