5 ms·
You may have incomplete documents (e.g. documents with conditional sections, very much like XSLT): <code:if test="..."> <!-- whatever --> <code:e
by Mikhail_Edoshin 10y ago
You may have incomplete documents (e.g. documents with conditional sections, very much like XSLT):
<code:if test="...">
<!-- whatever -->
<code:else>
<!-- whatever -->
</code:if>
Here you'll first process your code part an copy the contents as they are and then process the contents; but in the source document the two languages are interspersed.
Or you may want to extend your text format with, say, literate programming and add code fragments and files. In my homegrown system it's like that:
<literate:fragment id="..." language="...">
<text:caption>...</text:caption>
<literate:code>...</literate:code>
</literate:fragment>
My text system already has a notion of captions so there's no need to add my own "literate:caption" here. Yet the other two "literate" elements are new an unique. Also, using a namespace here ensures that I'm sure not to have a clash if the base system adds their own "fragment" or "code" blocks.
- lmm 10y agoOK, I guess that takes things a level up. I don't like that kind of interspersed style and I don't think incomplete documents should be the same kind of thing as complete ones (e.g. one can't meaningfully validate your first example, because what if the "whatever" is an element that has to be present exactly once). But I can see that if you want to write things this way then namespaces help.
- erlehmann_ 10y ago“I don't like” seems to be an æsthetic argument, not a technical one.