Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:H4311/Projet-Grammaire-Langages

  • Loading branch information...
commit d1d6da4ea50151a21115fd4893fc354b8c689e4f 2 parents 47859a0 + 3923684
@alahache alahache authored
Showing with 52 additions and 2 deletions.
  1. +52 −2 xsl/Test.cpp
View
54 xsl/Test.cpp
@@ -252,7 +252,32 @@ struct HTMLGenerationTest_ApplyTemplates : public TestCase
HTMLGenerationTest_ApplyTemplates() : TestCase("<fr> Vérifier le HTML généré, avec un XSL contenant des noeuds apply-templates") {}
bool operator()()
{
- /** @todo Implement the test. */
+ dtd::Document* dtdXSL = NULL;
+ xml::Document* documentXSL = NULL;
+ xml::Document* documentXML = NULL;
+ xml::Document* documentHTML = NULL;
+ try{
+ dtdXSL = parseDTD("./tests/xsl.dtd");
+ xsl::XSLProcessor xslProcessor = XSLProcessor();
+ xslProcessor.setXslDTD(dtdXSL);
+ documentXSL = parseXML("./tests/testApplyTemplates.xsl");
+ xslProcessor.processXslFile(documentXSL);
+ documentXML = parseXML("./tests/testApplyTemplates.xml");
+ documentHTML = xslProcessor.generateHtmlFile(documentXML);
+ }catch(string s){
+ delete dtdXSL;
+ delete documentXSL;
+ delete documentXML;
+ delete documentHTML;
+ return false;
+ }
+ // Validation Humaine
+ cout << documentHTML << endl;
+ delete dtdXSL;
+ delete documentXSL;
+ delete documentXML;
+ delete documentHTML;
+
return true;
}
};
@@ -262,7 +287,32 @@ struct HTMLGenerationTest_Attribute : public TestCase
HTMLGenerationTest_Attribute() : TestCase("<fr> Vérifier le HTML généré, avec un XSL contenant des noeuds attributes") {}
bool operator()()
{
- /** @todo Implement the test. */
+ dtd::Document* dtdXSL = NULL;
+ xml::Document* documentXSL = NULL;
+ xml::Document* documentXML = NULL;
+ xml::Document* documentHTML = NULL;
+ try{
+ dtdXSL = parseDTD("./tests/xsl.dtd");
+ xsl::XSLProcessor xslProcessor = XSLProcessor();
+ xslProcessor.setXslDTD(dtdXSL);
+ documentXSL = parseXML("./tests/testAttribute.xsl");
+ xslProcessor.processXslFile(documentXSL);
+ documentXML = parseXML("./tests/testAttribute.xml");
+ documentHTML = xslProcessor.generateHtmlFile(documentXML);
+ }catch(string s){
+ delete dtdXSL;
+ delete documentXSL;
+ delete documentXML;
+ delete documentHTML;
+ return false;
+ }
+ // Validation Humaine
+ cout << documentHTML << endl;
+ delete dtdXSL;
+ delete documentXSL;
+ delete documentXML;
+ delete documentHTML;
+
return true;
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.