[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Enlightenment via avoiding the T-word
Nicolas, Close, but I think where you're on the wrong track is that the "autmatically generate unique name" is a uniquely _qualified_ name (i.e., ulabel), not a unique local name, as you have below. That way we can can exploit namespaces. Just as the bar member of the Foo class of the Baz package has the locally unique name bar and the globally unique name Baz.Foo.bar. The Baz.Foo part is the equivalent of the namespace, so bar is the label, and Baz.Foo.bar is the ulabel. You only need the ulabel for disambiguation. So if we're talking about the "name" that's local to "person" in the "example" namespace, then we've create an "example/person" namespace and put "name" in it. Assuming the "example" namespace has the prefix "Ex" and the "example/person" namespace has the prefix "ExP", your examples can be: > -----Original Message----- > From: Nicolas LEHUEN [mailto:nicolas.lehuen@u...] > Sent: Thursday, August 30, 2001 12:33 AM > To: Fuchs, Matthew; 'xml-dev@l...' > Subject: RE: Enlightenment via avoiding the T-word > > > That's an interesting point. Giving unique name to local > elements looks to > me pretty much as a task a validator could perform, the > result being shoved > into a <i>kind of</i> PSVI. Indeed, to me, a good candidate > for a unique > name would be the canonical XPath of the local element in a > valid document, > or better, the canonical XPath of the local element relative > to the global > element containing it. > > If you give an automatically generated unique name to a local > element (like > Java compiler do with inner classes, be it anonymous or not), > I suspect our > template : > > <xsl:template match="person/name"/> > This is fine, as "name" is unique in person. > (name being a local element defined in the person global element) > > would become : > > <xsl:template match="__unique__person__name"/> > If you want to refer to "name" outside of the scope of "person" you'd need: <xsl:template match="ExP:name"/> > Or something like that. However, in the second sample, in > which we wanted to > process the buyer's name and the seller's name in different ways, the > template : > > <xsl:template match="buyer/person/name"/> > Once again, this is fine. Or to be more specific (if there are various "person"'s floating around: <xsl:template match="buyer/Ex:person/name"/> > Becomes : > > <xsl:template match="buyer/person/__unique__person__name"/> > > or : > > <xsl:template match="buyer//__unique__person__name"/> > Neither of these are necessary. > So, finally, what is the benefit ? > Does it make more sense now? Matthew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|