Results 1 to 7 of 7

Thread: [RESOLVED] Accessing another xml file from within xsl:for-each

  1. #1

    Thread Starter
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Music city, U.S.A.
    Posts
    1,253

    Resolved [RESOLVED] Accessing another xml file from within xsl:for-each


    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.
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

  2. #2
    Addicted Member
    Join Date
    Sep 2005
    Posts
    150

    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.

  3. #3
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Accessing another xml file from within xsl:for-each

    I would combine both xml files before sending it to the xsl

  4. #4

    Thread Starter
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Music city, U.S.A.
    Posts
    1,253

    Re: Accessing another xml file from within xsl:for-each

    Thanks for that info, Mark. I was starting to think that was the case.
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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?

  6. #6

    Thread Starter
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Music city, U.S.A.
    Posts
    1,253

    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.
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

  7. #7

    Thread Starter
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Music city, U.S.A.
    Posts
    1,253

    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.
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width