0

I cannot get the xsl rendered version to display anything other than a blank white page in Chrome/Firefox. Both of the pages live in QuickBase (in other words, I'm not testing this using local files which caused issues in this thread).

If you access both the data xml and the xsl individually, they render fine. Ugh, help!

<?xml version="1.0" ?>
<!-- Generated by QuickBase Jan  5 2012 15:49:19 -->
<!-- Created Fri, 20 Jan 2012 02:01:56 -0500 -->
<?xml-stylesheet type="text/xsl" href="bgfn9a4ns?act=DBpage&amp;pagename=test.xsl"?>
<document>
 <dbinfo>
  <name>Contacts</name>
  <desc></desc>
 </dbinfo>
 <variables>
 </variables>
 <chdbids>
 </chdbids>
 <record>
  <name>Bob</name>
  <update_id>1327024286746</update_id>
 </record>
 <record>
  <name>Joe</name>
  <update_id>1327024284265</update_id>
 </record>
 <record>
  <name>John</name>
  <update_id>1327024292753</update_id>
 </record>
 <record>
  <name>Nate</name>
  <update_id>1327024289819</update_id>
 </record>
</document>

And here is the content of the XSL:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0"/>
 <xsl:template match="/">
  <test>
   <xsl:for-each select="document/record">
    <xsl:attribute name="person"><xsl:value-of select="name"/></xsl:attribute>
   </xsl:for-each>
  </test>
  <FOO>BAR</FOO>
 </xsl:template>
</xsl:stylesheet>
Community
  • 1
  • 1
doremi
  • 14,921
  • 30
  • 93
  • 148

1 Answers1

1

The browsers are doing what is required of them, but there is no text to display in the output from your transformation, which looks like this

<?xml version="1.0" encoding="utf-8"?>
<test person="Nate"/>

You have declared a single <test> element for output, and are looping over all document/record elements assigning a person attribute equal to the <name> element from the XML. An element cannot have multiple attributes with the same name, so it has just one equal to the last name found.

Borodin
  • 126,100
  • 9
  • 70
  • 144
  • Shouldn't I be able to see the rendered XML anyway? Why wouldn't it? And perhaps this is a poor example, but I've tried adding other test elements and it makes no difference, the page still renders a blank page. – doremi Jan 20 '12 at 04:20
  • 1
    @JoshuaMcGinnis You _are_ seeing the rendered XML. Since it has no visible content, it looks like a blank page. – Paul Butcher Jan 20 '12 at 10:34
  • OK - I understand what you're saying, but even with a node of something, I should still see something! I don't! – doremi Jan 20 '12 at 19:28
  • I modified the code to include a node with some content. This evening, I will post the example on the web so that you can test. Thanks for your help so far Paul and Borodin. – doremi Jan 20 '12 at 19:31