ebeshero/newtFire-webDev

Namespaces? What's up with that?

Closed this issue · 2 comments

RJP43 commented

Pressing that we explain namespaces for schematron and going forward from here for XSLT, etc.

Have to tell schematron working with TEI... Why? Where does the namespace declaration go? Is it a link? Where does the declaration point to?

Might write this up so it can be linked by multiple tutorials from here on out?

At the very least needs to be brought up in class.

@RJP43 See my new "Long note to the curious" about Namespaces on the explainSchematron.html page.

Okay--@djbpitt convinced me to reduce the complexity of my Long Note to the Curious for the courtesy of brand new learners, so I'm going to just paste the full text of it here as I'm revising it, so we don't lose the detail.

A Long Note on Namespaces for the Curious: In XML and its family of languages, all elements and attributes always exist in some kind of namespace, even an empty (default or no) namespace. Namespaces are designed to distinguish different uses of the same element names, so when we are working with a document in a defined namespace, we must specify them and use prefixes where necessary to make sure our code functions properly. Namespace differentiation is absolutely critical in forms of code that read and map to other kinds of code, like Schematron reading and governing TEI XML. Schematron’s handling of namespaces is different from XSLT, where we will not have to set a namespace prefix on TEI (or other namespaced) elements once we set a special xpath-default-namespace, but we will have to use the special xsl: namespace prefix on every XSLT element. These are coding conventions that vary from language to language, so when you write these coding languages you look up what the appropriate rules and conventions are for working with namespaces in each. We have learned to accept the differences in namespace specifications, and if you find them confusing (as we do sometimes) you are certainly not alone! See the w3Schools explanation of namespaces and their prefixes: this simple explanation helps to show that the URI (the part that looks like a website address in the namespace declaration) is actually a standardized string of text that differentiates one namespace from another and does not actually have to point to an actual web resource at all (though sometimes it can if a code developer wants to share information publicly about the namespace). Jeni Tennison helpfully explains in a 2007 blog post what people tend to find confusing and tend to get wrong about namespaces and something more about why they are critically important for our code to work.