views:

164

answers:

0

Hi All,

I've been trying things for the last 3 days to figure this out, and just can't seem to get it! I am loading an XML response from a third party, which I can receive and strip to just text to display on a div.

But, when I try to transform it with an xslt into the div, it doesn't work! Nothing shows up in the div. I just want it to show up on the form nice and formatted, and I am open to other ways as well. By adding the xslt as a header line on the XML file saved to my hard drive, it works beautifully. I am including jquery, xslt, etc to no avail. Any help is MUCH appreciated! Here is my code (including things I am trying to get it to work:

<script type="text/javascript" src="http://www.mydomain.com/jquery.form.js"&gt;&lt;/script&gt; 

<script type="text/javascript"> 
    // wait for the DOM to be loaded 
    $(document).ready(function() { 
        // bind 'theForm' and provide a simple callback function 
        $('#theForm').ajaxForm(function(responseXML) { 
            //dataType = 'html'
            //var message = $('ieiresponse', responseXML).text();
            //var message2 = $('ieiresponse', responseXML).html();
           // var message3 = $('ieiresponse', responseXML);
          // var message4 = responseXML;
          var message5 = $('ieiresponse', responseXML).load();
            alert(message5); 
           // $('#ieiresult').load(responseXML, function() {
            //  alert('Load was performed.');
            //});
            $('#output').xslt({xmlUrl: message5, xslUrl: 'http://www.mydomain.com/xmltemplate3.xsl'});
         // $("#output").transform({xml:message3,xsl:"http://www.mydomain.com/xmltemplate3.xsl"});
          // $('#output').html(message4); 
         // $('#output').xslt({xmlUrl: message3, xslUrl: "http://www.mydomain.com/xmltemplate3.xsl"});   
            alert("done");       
        }); 
    }); 
</script> 

This is a sample except from my XML File:

<?xml version="1.0" encoding="utf-8"?>
<ieiresponse>
  <requestinformation code="100">
    <codemessage>RECORDS FOUND</codemessage>
    <inputs>
      <firstname>TEST</firstname>
      <lastname>TESTER</lastname>
      <product>TEST</product>
      <includenulldob>0</includenulldob>
      <exactdobmatchonly>0</exactdobmatchonly>
      <exactnamematchonly>0</exactnamematchonly>
      <probability>DEFAULT</probability>
      <includejurisdictionssearched>0</includejurisdictionssearched>
    </inputs>
  </requestinformation>
  <criminalinformation>
    <records count="14">
      <record id="TEST">
        <category>TEST</category>
        <sourceorjurisdiction>TEST</sourceorjurisdiction>
        <state>AR</state>
        <fullname>Test Tester</fullname>
        <firstname>Test</firstname>
        <middlename>T</middlename>
        <lastname>Tester</lastname>
        <fulldob>01/12/1984</fulldob>
        <sex>MALE</sex>
        <race>CAUCASIAN</race>
        <haircolor>BLONDE</haircolor>
        <eyecolor>HAZEL</eyecolor>
        <weight>150 LBS.</weight>
        <height>67 INCHES</height>
        <photoname>TEST.jpg</photoname>
        <aliases count="3">
          <alias>
            <fullname>TE LES TES JR</fullname>
          </alias>
          <alias>
            <fullname>Test Tester II</fullname>
          </alias>
          <alias>
            <fullname>TEST LEE TESTER SR</fullname>
          </alias>
        </aliases>
        <offenses count="2">
          <offense>
            <offensedescription>Crime1</offensedescription>
          </offense>
          <offense>
            <offensedescription>Crime2</offensedescription>
          </offense>
        </offenses>
      </record>
    </records>
  </criminalinformation>
</ieiresponse>

And a sample from my XSLT file:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl> //I have tried it with and without xmlns:p="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  <xsl:output method="html" indent="yes"/>
  <xsl:template match="/ieiresponse">
    <html>
      <head>
 </head>
      <body>
    <div class="container">
          <xsl:if test="requestinformation/inputs">
            <xsl:if test="requestinformation/inputs/product">
</xsl:if>
            <div class="requestInfo">
              <table class="outerTable">
                <tr>
                  <td class="wideTd">
                    <h2>Requested Information</h2>
                    <table class="inputTable">
                      <xsl:if test="requestinformation/inputs/firstname">
                        <tr>
                          <td>
                            <strong>First Name:</strong>
                          </td>
                          <td>
                            <xsl:value-of select="requestinformation/inputs/firstname"/>
                          </td>
                        </tr>
                      </xsl:if>
                      <xsl:if test="requestinformation/inputs/middlename">
                        <tr>
                          <td>
                            <strong>Middle Name:</strong>
                          </td>
                          <td>
                            <xsl:value-of select="requestinformation/inputs/middlename"/>
                          </td>
                        </tr>
                      </xsl:if>
                      <xsl:if test="requestinformation/inputs/lastname">
                        <tr>
                          <td>
                            <strong>Last Name:</strong>
                          </td>
                          <td>
                            <xsl:value-of select="requestinformation/inputs/lastname"/>
                          </td>
                        </tr>

    ...
    </xsl:template>

    </xsl:stylesheet>

Again, my xml file will look fantastic when I just hard code the header to include the xslt on the hard drive, but for some reason won't work this way. Is there an easier/better way to make this work? I have searched and tried other responses, but nothing seems to work. I am not an XML expert if that means anything :)

Thanks in advance!