Hi,
The xmlns attribute is not a reference to the schema - it is a namespace
declaration. If you want your document to be in a namespace, and you want
the stylesheet to be able to select elements from the document, you need to
declare the namespace in the stylesheet, and prefix the element names in the
stylesheet.
It would look like this, with the namespace declared at the top (and mapped
to the prefix "al", for example), and with all the element names from the
AuditLogin document prefixed with "al:"
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
xsl:output omit-xml-declaration="ye s" method="html" version="4.0"
media-type="text/html" indent="yes" encoding="iso88 59-1"
xmlns:al="http://tempuri.org/AuditLogon.xsd"/>
<xsl:template match="/">
<table cellpadding="10 " style="border:1 px solid blue">
<xsl:for-each select="al:Audi tLogonGroup/al:AuditLogon">
<tr>
<td style="border:1 px solid black">
<xsl:value-of select="al:User name"/> </td>
<td style="border:1 px solid black">
<xsl:value-of select="al:IPAd dress"/> </td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Hope that helps,
Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------
"Philip Rayne" <pr****@nospam. me> wrote in message
news:cb******** ***********@new s.demon.co.uk.. .
Probably a bit of a newbie question this. I have an XML file like this:
<?xml version="1.0" standalone="yes "?>
<AuditLogonGrou p xmlns="http://tempuri.org/AuditLogon.xsd" >
<AuditLogon>
<Username></Username>
<IPAddress></IPAddress>
</AuditLogon>
<AuditLogonGrou p>
I have a XSLT file that does this :
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="ye s" method="html" version="4.0"
media-type="text/html" indent="yes" encoding="iso88 59-1"/>
<xsl:template match="/">
<table cellpadding="10 " style="border:1 px solid blue">
<xsl:for-each select="AuditLo gonGroup xmlns/AuditLogon">
<tr>
<td style="border:1 px solid black">
<xsl:value-of select="Usernam e"/> </td>
<td style="border:1 px solid black">
<xsl:value-of select="IPAddre ss"/> </td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
This is not working. However, if I remove the
xmlns="http://tempuri.org/AuditLogon.xsd" part of the AuditLogonGroup tag
in the XML it works.
Can someone please tell me why it isn't working with the XSD file
associated with the XML?
Thanks.