Search in sources :

Example 1 with Stylesheet

use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.

the class XSLValidator method calculateProblems.

private void calculateProblems(StylesheetModel stylesheetComposed, XSLValidationReport report) throws MaxErrorsExceededException {
    // circular reference check
    checkCircularRef(stylesheetComposed, report);
    // include checks
    checkIncludesImports(stylesheetComposed, report);
    // template checks
    checkTemplates(stylesheetComposed, report);
    Stylesheet stylesheet = stylesheetComposed.getStylesheet();
    if (XSLT2_Version.equals(stylesheet.getVersion())) {
        checkFunctions(stylesheetComposed, report);
    }
    // call-template checks
    checkCallTemplates(stylesheetComposed, report);
    // call-template checks
    if (getPreference(ValidationPreferences.XPATHS) > IMarker.SEVERITY_INFO)
        checkXPaths(stylesheetComposed.getStylesheet(), report);
// TODO a) check globals and b) apply-templates where mode does not
// exist
}
Also used : Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet)

Example 2 with Stylesheet

use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.

the class TestStylesheet method testGetGlobalVariables.

@Test
public void testGetGlobalVariables() {
    Stylesheet stylesheet = builder.getStylesheet(getFile("globalVariablesTest.xsl"), false);
    assertNotNull("Model failed to load, returned NULL", stylesheet);
    List<Variable> globalVariablesList = stylesheet.getGlobalVariables();
    assertEquals("Wrong number of global variables returned.", 3, globalVariablesList.size());
}
Also used : Variable(org.eclipse.wst.xsl.core.model.Variable) Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet) Test(org.junit.Test)

Example 3 with Stylesheet

use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.

the class TestStylesheet method testGetVersion.

@Test
public void testGetVersion() {
    Stylesheet stylesheet = builder.getStylesheet(getFile("globalVariablesTest.xsl"), false);
    assertNotNull("Model failed to load, returned NULL", stylesheet);
    // Line Number is off by 1 from what is displayed in the Editor
    assertEquals("Wrong version number returned.", "1.0", stylesheet.getVersion());
}
Also used : Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet) Test(org.junit.Test)

Example 4 with Stylesheet

use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.

the class TestStylesheet method testGetAttributes.

@Test
public void testGetAttributes() {
    Stylesheet stylesheet = builder.getStylesheet(getFile("globalVariablesTest.xsl"), false);
    assertNotNull("Model failed to load, returned NULL", stylesheet);
    Map<String, XSLAttribute> attributeList = stylesheet.getAttributes();
    assertEquals("Incorrect number of attributes", 4, attributeList.size());
    XSLAttribute attribute = stylesheet.getAttribute("exclude-result-prefixes");
    assertEquals("Wrong attribute returned:", "exclude-result-prefixes", attribute.getName());
}
Also used : XSLAttribute(org.eclipse.wst.xsl.core.model.XSLAttribute) Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet) Test(org.junit.Test)

Example 5 with Stylesheet

use of org.eclipse.wst.xsl.core.model.Stylesheet in project webtools.sourceediting by eclipse.

the class TestStylesheet method testGetImports.

@Test
public void testGetImports() {
    Stylesheet stylesheet = builder.getStylesheet(getFile("style1.xsl"), false);
    assertNotNull("Model failed to load, returned NULL", stylesheet);
    List<Import> includeList = stylesheet.getImports();
    assertEquals("Wrong number of includes returned.", 1, includeList.size());
}
Also used : Import(org.eclipse.wst.xsl.core.model.Import) Stylesheet(org.eclipse.wst.xsl.core.model.Stylesheet) Test(org.junit.Test)

Aggregations

Stylesheet (org.eclipse.wst.xsl.core.model.Stylesheet)19 Test (org.junit.Test)12 Function (org.eclipse.wst.xsl.core.model.Function)3 Import (org.eclipse.wst.xsl.core.model.Import)2 Include (org.eclipse.wst.xsl.core.model.Include)2 Template (org.eclipse.wst.xsl.core.model.Template)2 Variable (org.eclipse.wst.xsl.core.model.Variable)2 XSLModelObject (org.eclipse.wst.xsl.core.model.XSLModelObject)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)1 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)1 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)1 StylesheetModel (org.eclipse.wst.xsl.core.model.StylesheetModel)1 XSLAttribute (org.eclipse.wst.xsl.core.model.XSLAttribute)1