943,915 Members | Top Members by Rank

Apr 9th, 2009
0

xsl error

Expand Post »
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):
xml Syntax (Toggle Plain Text)
  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>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DaShiVa is offline Offline
4 posts
since Apr 2009
Apr 9th, 2009
0

Re: xsl error

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.)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DaShiVa is offline Offline
4 posts
since Apr 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in RSS, Web Services and SOAP Forum Timeline: How To Authenticate from Web Services
Next Thread in RSS, Web Services and SOAP Forum Timeline: Bad XML





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC