Skip to main content
fixing typos
Source Link
Chris Summers
  • 9.1k
  • 1
  • 22
  • 55

Using the same namespace on all your schema is a TERRIBLE idea. Especially if you ever use XML technologies to read values from the XML.

Imagine you have a Sandwich Schema and and a Restaurant Schema, both schemas have a field called "Name". Now for what ever reason you need to merge these resulting Component XMLs into one document. All the nodes in the combined document will be in the same namespace. So the following XPATH would mathmatch the "Name" nodes of the sandwich and the resterauntrestaurant

<xsl:value-of select="//Name"/>

If you used namespaces correctly you could use the following XPATH queries to access specific nodes

<xsl:value-of select="//sandwich:Name"/>

and

<xsl:value-of select="//resterauntrestaurant:Name"/>

This example is a very simple one (and a bad practice as it uses //), but illustrates the point. It will become more significant when you start using apply-templates etc.

Using the same namespace on all your schema is a TERRIBLE idea. Especially if you ever use XML technologies to read values from the XML.

Imagine you have a Sandwich Schema and and a Restaurant Schema, both schemas have a field called "Name". Now for what ever reason you need to merge these resulting Component XMLs into one document. All the nodes in the combined document will be in the same namespace. So the following XPATH would math the "Name" nodes of the sandwich and the resteraunt

<xsl:value-of select="//Name"/>

If you used namespaces correctly you could use the following XPATH queries to access specific nodes

<xsl:value-of select="//sandwich:Name"/>

and

<xsl:value-of select="//resteraunt:Name"/>

This example is a very simple one (and a bad practice as it uses //), but illustrates the point. It will become more significant when you start using apply-templates etc.

Using the same namespace on all your schema is a TERRIBLE idea. Especially if you ever use XML technologies to read values from the XML.

Imagine you have a Sandwich Schema and and a Restaurant Schema, both schemas have a field called "Name". Now for what ever reason you need to merge these resulting Component XMLs into one document. All the nodes in the combined document will be in the same namespace. So the following XPATH would match the "Name" nodes of the sandwich and the restaurant

<xsl:value-of select="//Name"/>

If you used namespaces correctly you could use the following XPATH queries to access specific nodes

<xsl:value-of select="//sandwich:Name"/>

and

<xsl:value-of select="//restaurant:Name"/>

This example is a very simple one (and a bad practice as it uses //), but illustrates the point. It will become more significant when you start using apply-templates etc.

Source Link
Chris Summers
  • 9.1k
  • 1
  • 22
  • 55

Using the same namespace on all your schema is a TERRIBLE idea. Especially if you ever use XML technologies to read values from the XML.

Imagine you have a Sandwich Schema and and a Restaurant Schema, both schemas have a field called "Name". Now for what ever reason you need to merge these resulting Component XMLs into one document. All the nodes in the combined document will be in the same namespace. So the following XPATH would math the "Name" nodes of the sandwich and the resteraunt

<xsl:value-of select="//Name"/>

If you used namespaces correctly you could use the following XPATH queries to access specific nodes

<xsl:value-of select="//sandwich:Name"/>

and

<xsl:value-of select="//resteraunt:Name"/>

This example is a very simple one (and a bad practice as it uses //), but illustrates the point. It will become more significant when you start using apply-templates etc.