Re: [xsl] Pointers are weird

Subject: Re: [xsl] Pointers are weird
From: "Peter Flynn peter@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Apr 2025 10:55:20 -0000
On 11/04/2025 11:32, Roger L Costello costello@xxxxxxxxx wrote:
XML has pointers, e.g.,

<Book ref="SK">...</Book>

<Author id="SK">Stephen King</Author>

The value of the ref attribute, "SK", points to <Author id="SK">

"SK" doesn't look like a pointer to me. It looks like data.

The ref attribute must be defined as type IDREF (or IDREFS) and the id attribute must be defined as type ID (or given as xml:id instead). Then it is a pointer and target; otherwise it's just data, as you say.


> XML-aware tools, however, treat it as a pointer to the <Author>
> element with a matching id value.

Only if correctly defined.

HTML has pointers, e.g.,

<a href="#lesson1">...</a>

<p id="lesson1">...</p>

The value of the href attribute, "#lesson1", points to <p id="lesson1">

That's a convention. In older HTML DTDs, the id was indeed defined as type ID, but href was never an IDREF. So in XML terms, it's just data.


I conclude that, in XML and HTML, a pointer is not a pointer at all.

No, when properly defined, pointers and targets work perfectly.


Isn't that weird?

No, I think it's normal for a language to have rules; if you use the rules, it works; if you don't use the rules, it doesn't work.


Peter

Current Thread