{"action":"created","issue":{"url":"https://api.github.com/repos/obdurodon/dh_course/issues/70","repository_url":"https://api.github.com/repos/obdurodon/dh_course","labels_url":"https://api.github.com/repos/obdurodon/dh_course/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/obdurodon/dh_course/issues/70/comments","events_url":"https://api.github.com/repos/obdurodon/dh_course/issues/70/events","html_url":"https://github.com/obdurodon/dh_course/issues/70","id":314359600,"number":70,"title":"XSLT vs XQuery","user":{"login":"JosephDRogers23","id":8711090,"avatar_url":"https://avatars2.githubusercontent.com/u/8711090?v=4","gravatar_id":"","url":"https://api.github.com/users/JosephDRogers23","html_url":"https://github.com/JosephDRogers23","followers_url":"https://api.github.com/users/JosephDRogers23/followers","following_url":"https://api.github.com/users/JosephDRogers23/following{/other_user}","gists_url":"https://api.github.com/users/JosephDRogers23/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephDRogers23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephDRogers23/subscriptions","organizations_url":"https://api.github.com/users/JosephDRogers23/orgs","repos_url":"https://api.github.com/users/JosephDRogers23/repos","events_url":"https://api.github.com/users/JosephDRogers23/events{/privacy}","received_events_url":"https://api.github.com/users/JosephDRogers23/received_events","type":"User","site_admin":false},"labels":[{"id":894977756,"url":"https://api.github.com/repos/obdurodon/dh_course/labels/Discussion","name":"Discussion","color":"ed4b94","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-14T20:31:22Z","updated_at":"2018-04-14T22:31:39Z","closed_at":null,"author_association":"NONE","body":"Doing the data transformation for our project's social network graph made me think of how easy it is for me to think in XSLT vs XQuery. For example, my first thought to write the transformation was to do it in XQuery because I could visualize the code that way first, but Zac pointed out that the code would probably be simpler to write in XSLT, and that's how I ended up doing the transformation. Which do you find easier to think in? "},"comment":{"url":"https://api.github.com/repos/obdurodon/dh_course/issues/comments/381365212","html_url":"https://github.com/obdurodon/dh_course/issues/70#issuecomment-381365212","issue_url":"https://api.github.com/repos/obdurodon/dh_course/issues/70","id":381365212,"user":{"login":"djbpitt","id":6233052,"avatar_url":"https://avatars0.githubusercontent.com/u/6233052?v=4","gravatar_id":"","url":"https://api.github.com/users/djbpitt","html_url":"https://github.com/djbpitt","followers_url":"https://api.github.com/users/djbpitt/followers","following_url":"https://api.github.com/users/djbpitt/following{/other_user}","gists_url":"https://api.github.com/users/djbpitt/gists{/gist_id}","starred_url":"https://api.github.com/users/djbpitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djbpitt/subscriptions","organizations_url":"https://api.github.com/users/djbpitt/orgs","repos_url":"https://api.github.com/users/djbpitt/repos","events_url":"https://api.github.com/users/djbpitt/events{/privacy}","received_events_url":"https://api.github.com/users/djbpitt/received_events","type":"User","site_admin":false},"created_at":"2018-04-14T22:31:39Z","updated_at":"2018-04-14T22:31:39Z","author_association":"CONTRIBUTOR","body":"@JosephDRogers23 As you might imagine, opinions and preferences often diverge more than the languages themselves. I just read two postings from XQuery partisans: <https://en.wikibooks.org/wiki/XQuery/Typeswitch_Transformations> and <https://en.wikibooks.org/wiki/XQuery/Benefits>, and the arguments, while accurate in their details, draw inappropriately general conclusions from individual experience. For example, XQuery syntax is certainly easier for an SQL programmer to learn than XSLT, but the fact that XSLT is written in XML syntax isn’t a problem for those who are comfortable with XML syntax. Additionally, we sometimes write XSLT to create XSLT, and since XSLT excels at outputting XML syntax, it turns out to be an advantage that XSLT is expressed in XML. \r\n\r\nThe `typeswitch()` expression  in XQuery, which is the focus of the two links above, is a way of mimicking XSLT templates in XQuery, which is to say that it is not especially familiar to SQL programmers. And while `switch()` operations may be familiar to programmers in many languages, `typeswitch()` requires a different level of abstraction. Learning to use `typeswitch()` isn’t difficult, but it isn’t consistent to argue that XQuery is likely to be more familiar than XSLT to those who are new to both, which is true in many ways, while understating how unusual `typeswitch()` is, given its singular importance in using XQuery as an XSLT replacement. Ultimately, XSLT is declarative to its bones, while XQuery’s reliance on FLWOR as its principal method of flow control is fundamentally imperative. And just as one can write declarative XQuery with `typeswitch()`, one can write imperative XSLT with `<xsl:for-each>`. Both are legitimate uses of their respective languages, but neither is especially integral to the rest of the general language paradigm.\r\n\r\n@ebeshero sums up the comparison well when she writes that “one’s perception of ‘ease’ probably has to do with the idiom one is most accustomed to for thinking.” My own experience of feeling more comfortable with XSLT is similar to @jachinn’s, but I often use small XQuery scripts during development when what I need to explore is too complex to fit in &lt;oXygen/&gt;’s XPath browser widget. When I use XQuery in production to create HTML, I almost always pipe the XQuery result into XSLT before returning it. But that won’t necessarily be the best approach for everyone. For example, if you’re the type of XSLT programmer who thinks every XSLT transformation problem is best solved with `<xsl:for-each>` (= nobody in our courses!), you’d probably be happier doing everything in XQuery, and that wouldn’t be a wrong choice.\r\n"}}
{"actor":{"display_login":"djbpitt"}}