Project

Profile

Help

XSLT and the XMLSchema Namespace

Added by Anonymous about 17 years ago

Legacy ID: #4528665 Legacy Poster: Jeffrey Lage (jlage)

I have the following document: <?xml version="1.0" encoding="UTF-8"?> <a:scenario_result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.funddevelopmentservices.com/asgard" status="passed"> <a:steps> <a:step status="passed"> <a:columns> <a:column xsi:type="a:InputColumn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <a:name>fundName</a:name> <a:ordinal>0</a:ordinal> </a:column> <a:columns> <a:step> <a:steps> <a:scenario_result> if i apply the following XPath statement: /a:scenario_result/a:steps[1]/a:step[1]/a:columns[1]/a:column[1]/@xsi:type i get this result: a:InputColumn However, if i apply the following XSL to the same document: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xsl a" version="2.0" xmlns:a="http://schemas.funddevelopmentservices.com/asgard"> <xsl:template match="/a:scenario_result"> <html> <body> <xsl:for-each select="a:steps[1]/a:step"> <xsl:for-each select="a:columns[1]/a:column"> <h1><xsl:value-of select="@xsi:type" /></h1> </xsl:for-each> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> i get the following HTML: <?xml version="1.0" encoding="UTF-8"?><html xmlns:xsi="http://www.w3.org/2001/XMLSchema"> <body> <h1></h1> </body> </html> why is the XSL unable to find this attribute value if xpath is? if i change the namespace uri to anything other than the one of XMLSchema it works exactly as expected


Replies (1)

RE: XSLT and the XMLSchema Namespace - Added by Anonymous about 17 years ago

Legacy ID: #4529174 Legacy Poster: Michael Kay (mhkay)

The namespace URI used in the stylesheet must match that in the source document. In your stylesheet, please change xmlns:xsi="http://www.w3.org/2001/XMLSchema" to xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Michael Kay Saxonica

    (1-1/1)

    Please register to reply