Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Apr 2009
Posts: 4
Reputation: DaShiVa is an unknown quantity at this point 
Solved Threads: 0
DaShiVa DaShiVa is offline Offline
Newbie Poster

xsl error

 
0
  #1
Apr 9th, 2009
Having an issue where both my xml and xsl are parsing fine (when viewed in firefox) but when combined together, throw an error:
Error loading stylesheet: Parsing an XSLT stylesheet failed.
(I noticed a suimilar post but was reccommended by the system to start a new thread, as it was a year old)
Betting it's something simple I can kick myself for...
my xml (trimmed):
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet href="reporting.xsl" type="text/xsl"?>
  3. <Report>
  4. <Overview>in progress</Overview>
  5. <Header>
  6. <Field>
  7. <Name>Date</Name>
  8. <Type>date</Type>
  9. </Field>
  10. <Field>
  11. <Name>Status</Name>
  12. <Type>string</Type>
  13. </Field>
  14. <Field>
  15. <Name>Product1</Name>
  16. <Type>currency</Type>
  17. </Field>
  18. <Field>
  19. <Name>Product2</Name>
  20. <Type>currency</Type>
  21. </Field>
  22. <Field>
  23. <Name>Total</Name>
  24. <Type>currency</Type>
  25. </Field>
  26. </Header>
  27. <Results>
  28. <Result>
  29. <Field>
  30. <Value>04/09/2006</Value>
  31. <Sort>1144558800</Sort>
  32. </Field>
  33. <Field>
  34. <Value>Approved</Value>
  35. <Sort>1</Sort>
  36. </Field>
  37. <Field>
  38. <Value>$598.06</Value>
  39. <Sort>598.06</Sort>
  40. </Field>
  41. <Field>
  42. <Value>$749.67</Value>
  43. <Sort>749.67</Sort>
  44. </Field>
  45. <Field>
  46. <Value>$2,872.54</Value>
  47. <Sort>2872.54</Sort>
  48. </Field>
  49. </Result>
  50. <Result>
  51. <Field>
  52. <Value>05/09/2006</Value>
  53. <Sort>1147150800</Sort>
  54. </Field>
  55. <Field>
  56. <Value>Approved</Value>
  57. <Sort>1</Sort>
  58. </Field>
  59. <Field>
  60. <Value>$274.29</Value>
  61. <Sort>274.29</Sort>
  62. </Field>
  63. <Field>
  64. <Value>$815.49</Value>
  65. <Sort>815.49</Sort>
  66. </Field>
  67. </Field>
  68. <Field>
  69. <Value>$1,788.34</Value>
  70. <Sort>1788.34</Sort>
  71. </Field>
  72. </Result>
  73. </Results>
  74. </Report>
my xsl:
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
  3. <xsl:output method='html' indent='yes' media-type='text/html' />
  4.  
  5. <xsl:template match='/'>
  6. <xsl:apply-templates />
  7. </xsl:template>
  8.  
  9. <xsl:template match='Overview'>
  10. <h1>Overview</h1>
  11. </xsl:template>
  12.  
  13. <xsl:template match='Header'>
  14. <tr>
  15. <xsl:for-each match='Field'>
  16. <th><xsl:value-of select='Name' /></th>
  17. </xsl:for-each>
  18. </tr>
  19. </xsl:template>
  20.  
  21. <xsl:template match='Results'>
  22. <table>
  23. <tbody>
  24. <xsl:for-each select='Result'>
  25. <xsl:call-template name='Result' />
  26. </xsl:for-each>
  27. </tbody>
  28. </table>
  29. </xsl:template>
  30.  
  31. <xsl:template name='Result'>
  32. <tr>
  33. <xsl:for-each match='Field'>
  34. <td><xsl:value-of select='Value' /></td>
  35. </xsl:for-each>
  36. </tr>
  37. </xsl:template>
  38.  
  39. </xsl:stylesheet>
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 4
Reputation: DaShiVa is an unknown quantity at this point 
Solved Threads: 0
DaShiVa DaShiVa is offline Offline
Newbie Poster

Re: xsl error

 
0
  #2
Apr 9th, 2009
OK, figured it out
1) not an error as such, but the result would have put the header rows before the table, so restructured the xml and xsl to put teh header inside the result xml and html table.
2) the actual error: something dumb:
<xsl:for-each match='Field'> should be:
<xsl:for-each select='Field'> firefox (at least) doesnt see that as an error (and I guess it's not exactly an error, but.. it is.)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the RSS, Web Services and SOAP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC