Название: xml + xslt Отправлено: scofield от Декабрь 21, 2013, 20:43 доброй ночи.
имеем xml документ и xslt шаблон . шаблон не совсем верен , ссылка на xml http://rofr.ivoa.net/cgi-bin/oai.pl?verb=ListRecords&metadataPrefix=oai_dc (http://rofr.ivoa.net/cgi-bin/oai.pl?verb=ListRecords&metadataPrefix=oai_dc) шаблон : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:oai="http://www.openarchives.org/OAI/2.0/"> oaidc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/http://www.openarchives.org/OAI/2.0/oai_dc.xsd" <xsl:output method="xml" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> <xsl:template match="/"> <html> <head> <meta charset="UTF-8" /> <title>ListMetadataFormats</title> </head> <body> <h1>Test XSLT</h1> <p>Response Date: <xsl:value-of select="oai:OAI-PMH/oai:responseDate"/></p> <xsl:apply-templates select="oai:OAI-PMH/oai:ListMetadataFormats"/> </body> </html> </xsl:template> <xsl:template match="oai:ListMetadataFormats"> <p>ListMetadataFormats:</p> <ul> <xsl:apply-templates select="oai:metadataFormat"/> </ul> </xsl:template> <xsl:template match="oai:metadataFormat"> <li><xsl:value-of select="oai:metadataPrefix"/></li> </xsl:template> </xsl:stylesheet> Ошибка : gidvin@gidvin-ES1105N:~/QtHttpExample$ ./QtHttpExample Error FODC0002 in file:///home/gidvin/QtHttpExample/astra.xml, at line 13, column 131: Namespace prefix 'oaidc' not declared Warning in file:///home/gidvin/QtHttpExample/go.xslt, at line 5, column 51: Running an XSL-T 1.0 stylesheet with a 2.0 processor. Error XPDY0002 in file:///home/gidvin/QtHttpExample/go.xslt, at line 38, column 0: The focus is undefined. "" В чем дело вообщем понятно , вопрос как правильно обработать данный xml ? |