Message Boards Message Boards


Documentation for XML template tags

Posted 4 years ago
4 Replies
5 Total Likes

I've been searching the documentation of Mathematica for information on XML template tags, and I've searched the internet for examples and demonstrations, but I haven't found any. Where can I find information about XML template tags?

For example I learned from this question about id=\"SequenceIndex\"/> but where is SequenceIndex documented? And where is it even said that "id" specifies the slot name?

I know of these examples already.

4 Replies

The documentation for the XML templating language is here:

The "id" attribute is just part of XML and the value of "id" is just some name the coder decided to give tag. It's not something special in the Wolfram Language's XML templating language. So there's no documentation for it. "id" is the same here as it is in the rest of XML, it's basically just a way to reference a certain tag. If you aren't sure what it is, ignore it for now.

Posted 4 years ago

Well, it was a poor example. What about the keyword "SequenceIndex", is this also commonly used in XML?

I should have mentioned that I had found that documentation but I found that as well to be terser than what I'd ideally have. Maybe if SequenceIndex is the only thing that isn't documented it would be ok, but it leaves you wondering what else you might be missing.

SequenceIndex is just a value given to this particular id attribute. Id attributes are used in a lot of different places - usually websites and are often references for javascript or css files. The id attribute is familiar to most people from HTML.

If you can't find something in the documentation above, you're probably lookin for information about XML itself, not for information on Mathematica's XML templating language. It's important to be familiar with XML before using this XML templating language. As far as I can see, the documentation above isn't missing anything.

Here's a short tutorial on how id is commonly used in webpages:

Posted 4 years ago

But my point is this: XML is just data. When you give the XML to TemplateApply it takes this data and it turns it into something else. The id attribute was arbitrarily chosen to contain the slot name. I can't think of anything that would allow us to know a priori that TemplateApply would interpret the id attribute as the name of the slot. Similarly, in a sequence, TemplateApply interprets <wolfram:slot id="SequenceIndex"/> as the number corresponding to the current element's position in the sequence. You cannot know a priori - or am I wrong? - that "SequenceIndex" is the keyword for this. It might as well have been <wolfram:slot id="Hello" /> that was chosen for this purpose. So my point from the very beginning has been this: these are two arbitrarily chosen keywords (id and SequenceIndex) that have a very specific meaning to TemplateApply. In themselves they don't have any meaning at all, though id is commonly used for many different things, but they become meaningful in the context of TemplateApply.

If it's not documented that's how it is. I'm just stating why I thought it would be documented. In the list of XML attributes it could have said that "id" is used to specify slot names. There could have been a note somewhere that said that id="SequenceIndex" inside <wolfram:sequence /> represents the position of the current element in the sequence.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract