{"action":"created","issue":{"url":"https://api.github.com/repos/hbi99/defiant.js/issues/80","repository_url":"https://api.github.com/repos/hbi99/defiant.js","labels_url":"https://api.github.com/repos/hbi99/defiant.js/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/hbi99/defiant.js/issues/80/comments","events_url":"https://api.github.com/repos/hbi99/defiant.js/issues/80/events","html_url":"https://github.com/hbi99/defiant.js/issues/80","id":171901799,"number":80,"title":"Defiant.js render bringing up error in Symphony CMS","user":{"login":"jude86-7","id":5243473,"avatar_url":"https://avatars.githubusercontent.com/u/5243473?v=3","gravatar_id":"","url":"https://api.github.com/users/jude86-7","html_url":"https://github.com/jude86-7","followers_url":"https://api.github.com/users/jude86-7/followers","following_url":"https://api.github.com/users/jude86-7/following{/other_user}","gists_url":"https://api.github.com/users/jude86-7/gists{/gist_id}","starred_url":"https://api.github.com/users/jude86-7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jude86-7/subscriptions","organizations_url":"https://api.github.com/users/jude86-7/orgs","repos_url":"https://api.github.com/users/jude86-7/repos","events_url":"https://api.github.com/users/jude86-7/events{/privacy}","received_events_url":"https://api.github.com/users/jude86-7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-18T13:32:31Z","updated_at":"2016-08-26T08:34:32Z","closed_at":"2016-08-26T08:34:32Z","body":"Hi, I'm just starting out with defiant.js so please excuse me if I'm going about this in the wrong way.\r\n\r\nI have a JSON file that I would like to search. So far I have a dropdown options box; the option is taken into the function and I use JSON.search to find the items I need. This prints in the console.log correctly.\r\n\r\nHowever I then need to print out the results on the webpage. I thought the .render would work best, I am using Symphony CMS which is based on XSLT. However when I include the following on my .xsl page I get the error below;\r\n\r\n`<script type=\"defiant/xsl-template\">\r\n<xsl:template name=\"first-template\">\r\n\t<xsl:for-each select=\"//item\">\r\n\t\t<h2><xsl:value-of select=\"title\"/></h2>\r\n\t\t<div><xsl:value-of select=\"region\"/></div>\r\n\t</xsl:for-each>\r\n</xsl:template>\r\n</script>`\r\n\r\nError:\r\nelement template only allowed as child of stylesheet\r\nFound a top-level element script with null namespace URI\r\n\r\nI presume this is because it's in an .xsl file rather than .html file. But with our CMS this is the only way we can do this.\r\n\r\nPlease can you let me know if what I would like to do is possible. Many thanks for your time."},"comment":{"url":"https://api.github.com/repos/hbi99/defiant.js/issues/comments/242666942","html_url":"https://github.com/hbi99/defiant.js/issues/80#issuecomment-242666942","issue_url":"https://api.github.com/repos/hbi99/defiant.js/issues/80","id":242666942,"user":{"login":"hbi99","id":637727,"avatar_url":"https://avatars.githubusercontent.com/u/637727?v=3","gravatar_id":"","url":"https://api.github.com/users/hbi99","html_url":"https://github.com/hbi99","followers_url":"https://api.github.com/users/hbi99/followers","following_url":"https://api.github.com/users/hbi99/following{/other_user}","gists_url":"https://api.github.com/users/hbi99/gists{/gist_id}","starred_url":"https://api.github.com/users/hbi99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hbi99/subscriptions","organizations_url":"https://api.github.com/users/hbi99/orgs","repos_url":"https://api.github.com/users/hbi99/repos","events_url":"https://api.github.com/users/hbi99/events{/privacy}","received_events_url":"https://api.github.com/users/hbi99/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T08:34:32Z","updated_at":"2016-08-26T08:34:32Z","body":"Hi,\r\nI have added a working version of your code here:\r\nhttps://github.com/hbi99/defiant.js/blob/master/demo/symphony.htm\r\n\r\nNotes:\r\n1. I changed the selection attribute as follows:\r\n```\r\n<xsl:for-each select=\"//mart\">\r\nTo:\r\n<xsl:for-each select=\"//*\">\r\n```\r\nThis is the correct way to select any matches that are about to be rendered.\r\n\r\n2. To render, you should use this syntax to trigger a render:\r\n```\r\nhtm = Defiant.render({\r\n\t\t'template': 'mart-template',\r\n\t\t'data': res,\r\n\t\t'sorter': {\r\n\t\t\t'order': 'descending',\r\n\t\t\t'select': 'title',\r\n\t\t\t'type': 'string'\r\n\t\t}\r\n\t});\r\n```\r\nThis passes an object with many possibilities for you to render, in any way you like.\r\n\r\n3. I have disabled this row:\r\n```\r\n$('#resultsForm').html(\"<p><strong>Loading...</strong></p>\");\r\n```\r\nThe reason is that the rendering will happen very fast...in fact, faster than it takes the browser to first put the placeholder and then replace it with rendered output. So, this row is redundant.\r\n\r\nLet me know if you encounter other problems :-)"}}
{"actor":{"display_login":"hbi99"}}