Jump to content

RikP

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by RikP

  1. Hello, I am having difficulty understanding how namespaces work. To my understanding, the namespace URI is added to an xml document with a qualifier so you can contextualize the content (i.e. differentiate two complex elements with the name "table" that may have different elements and attributes). I understand that the URI is not looked up, but rather to give the namespace a global unique identifier. This is where my confusion begins. Take for instance the following xml: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> </xs:schema> to my understanding, the elements or attributes prefixed with xsl (xsl:template, xsl:for-each, etc.), the XML parser recognizes to be part of the "http://www.w3.org/1999/XSL/Transform" namespace. My question is, if the URI is not used to lookup content, how does it check that the elements provided are all (valid) in the xsl prefixed namespace, or does it? What I do not understand is the following from the XSL Transformation Page, it states the following <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> How do we have "access" to elements, attributes, and features if no lookup is done? For instance, if I added the following element to the xml file: <xsl:foo>Made up element</xsl:foo> what happens? I know that foo is not a defined element inside of the xsl namespace, but how does a XML parser know that? How does the parser know what elements should/could be inside the prefixed namespace? Thanks in advance!
  2. Hello, I am having difficulty understanding how namespaces work. To my understanding, the namespace URI is added to an xml document with a qualifier so you can contextualize the content (i.e. differentiate two complex elements with the name "table" that may have different elements and attributes). I understand that the URI is not looked up, but rather to give the namespace a global unique identifier. This is where my confusion begins. Take for instance the following xml: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> </xs:schema> to my understanding, the elements or attributes prefixed with xsl (xsl:tempalte, xsl:for-each, etc.), the XML parser recognizes to be part of the "http://www.w3.org/1999/XSL/Transform" namespace. My question is, if the URI is not used to lookup content, how does it check that the elements provided are all (valid) in the xsl prefixed namespace, or does it? What I do not understand is the following from the XSL Transformation Page, it states the following <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> How do we have "access" to elements, attributes, and features if no lookup is done? For instance, if I added the following element to the xml file: <xsl:foo>Made up element</xsl:foo> what happens? I know that foo is not a defined element inside of the xsl namespace, but how does a XML parser know that? How does the parser know what elements should/could be inside the prefixed namespace? Thanks in advance!
×
×
  • Create New...