-1

I'm learning XML & XSLT on an online tutorial & have run into a cross browser issue with one of the exampleS.

the XML file is running properly in firefox 19.0 & IE9 but not in Chrome Version 25.0.1364.97.

Any idea why this is happening or what I should do to avoid browser issues?

This is my XML:

<?xml version="1.0" standalone="no" ?>

<?xml-stylesheet type="text/xsl" href="basic.xsl" ?>

<people>
    <husband employed = "Yes" >
        <name>Mark</name>
    <age>45</age>
    <wife>
        <wname>Janet</wname>
        <age>29</age>
    </wife>
    </husband>

    <husband employed = "No" >
        <name>Matt</name>
    <age>42</age>
    <wife>
        <wname>Annie</wname>
        <age>43</age>
    </wife>
    </husband>
</people>

& this is my basic.xsl file:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <html>
    <body>
    <table border="2px">
        <tr>
        <xsl:apply-templates/>
        </tr>
    </table>
    </body>
    </html>
</xsl:template>

<xsl:template match="husband">
    <td>
    <xsl:value-of select="name"/>
    </td>
</xsl:template>


</xsl:stylesheet>

The console readout from Chrome is:

Unsafe attempt to load URL file:///C:/Users/Ross/Desktop/XML%20Demos/basic.xsl from frame with URL file:///C:/Users/Ross/Desktop/XML%20Demos/people_externalXSL.xml. Domains, protocols and ports must match.

Holly
  • 7,462
  • 23
  • 86
  • 140

1 Answers1

0

Try this:

<xsl:template match="husband/name">
    <td>
    <xsl:value-of select="text()"/>
    </td>
</xsl:template>
A. M. Mérida
  • 2,458
  • 3
  • 18
  • 24
  • Why? The original code is better, and correct. Is this a workaround for some known bug, or just random variation to suck it and see? – Michael Kay Feb 27 '13 at 10:28