Trait

com.github.eerohele.expek

XsltSpecification

Related Doc: package expek

Permalink

trait XsltSpecification extends XsltResultMatchers with XPathSupport with XsltSupport

A specification for testing an XSLT stylesheet.

Classes that mix in this trait must define stylesheet, which is a File instance that points to the stylesheet that you want to test.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XsltSpecification
  2. XsltSupport
  3. XPathSupport
  4. XsltResultMatchers
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class withFiles(mockFiles: (FileSystem) ⇒ MockFile*) extends BeforeAfter with Product with Serializable

    Permalink

    Given a list of functions that take a Jimfs instance and return a MockFile, create the mockfiles in the given file system and delete them after running the specification.

    Given a list of functions that take a Jimfs instance and return a MockFile, create the mockfiles in the given file system and delete them after running the specification.

    The mock files are then available for parsing during the test. Any relative URIs and URIs that use Jimfs.URI_SCHEME as the scheme will be resolved against the given Jimfs file system.

Abstract Value Members

  1. abstract val stylesheet: Source

    Permalink

    The stylesheet you want to test.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object XPath

    Permalink
    Definition Classes
    XPathSupport
  5. object XSLT

    Permalink

    Functions for converting an XSLT stylesheet into a Source.

    Functions for converting an XSLT stylesheet into a Source.

    Definition Classes
    XsltSupport
  6. def applying(query: String)(input: ⇒ Node): TemplateApplication

    Permalink

    Apply the XSLT template for the node selected by the given XPath query, using the input Node as the context node.

    Apply the XSLT template for the node selected by the given XPath query, using the input Node as the context node.

    Equivalent to <xsl:apply-templates/>.

  7. def applying(input: ⇒ Node): TemplateApplication

    Permalink

    Apply the XSLT template for the given Node in the stylesheet defined in this specification.

    Apply the XSLT template for the given Node in the stylesheet defined in this specification.

    Equivalent to <xsl:apply-templates/>.

  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def asMap(tuple: (String, Any)*): Map[QName, XdmValue]

    Permalink

    Convert a sequence of tuples into a Map of parameters that Saxon understands.

  10. def attribute(a: (String, String)): XdmNode

    Permalink

    Create an XdmNode attribute() node.

    Create an XdmNode attribute() node.

    If your template or function expects an attribute, use this function.

  11. def beMatching(query: String): XPathResultMatcher[Transformation]

    Permalink

    A specs2 matcher that tests whether a node matches an XPath expression.

    A specs2 matcher that tests whether a node matches an XPath expression.

    Example:

    applying { <foo>x</foo> } must beMatching("bar[. eq 'x']")
  12. final val builder: DocumentBuilder

    Permalink

    A Saxon DocumentBuilder instance for converting DOM nodes into XML Data Model (XDM) instances

    A Saxon DocumentBuilder instance for converting DOM nodes into XML Data Model (XDM) instances

    Definition Classes
    XsltSpecificationXPathSupport
  13. def callingFunction(lexical: String)(parameters: Any*)(implicit namespace: String): FunctionCall

    Permalink

    Call an XSLT function, using the namespace URI defined implicitly in the XsltSpecification instance.

  14. def callingFunction(uri: String, lexical: String)(parameters: Any*): FunctionCall

    Permalink

    Call an XSLT function with the given parameters.

  15. def callingTemplate(name: String, contextNode: Node): TemplateCall

    Permalink

    Call a named XSLT template and supply a context node (as Node) for the transformation.

  16. def callingTemplate(name: String, contextNode: XdmNode): TemplateCall

    Permalink

    Call a named XSLT template and supply a context node (as XdmNode) for the transformation.

  17. def callingTemplate(name: String): TemplateCall

    Permalink

    Call a named XSLT template

  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final val configuration: Configuration

    Permalink

    An extensible Saxon Configuration instance.

    An extensible Saxon Configuration instance.

    Overriding is prevented to make it more difficult to accidentally lose the support for reading from and writing to an in-memory Jimfs file system.

  20. def convert(value: Any): Any

    Permalink
    Attributes
    protected
    Definition Classes
    XsltResultMatchers
  21. val defaultMatcher: (Source) ⇒ CompareMatcher

    Permalink

    The default matcher for comparing two XML element or document nodes.

  22. def documentNode(node: Node): XdmNode

    Permalink

    Convert an Elem into an XdmNode document-node() node.

  23. def element(node: Node): XdmNode

    Permalink

    Convert an Elem into an XdmNode element() node.

    Convert an Elem into an XdmNode element() node.

    By default, any Elem instance you create and give as a parameter is a document node. If your template or function expects an element, use this function.

  24. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  26. lazy val fileSystem: FileSystem

    Permalink

    The in-memory file system that stores MockFile instances and documents generated with <xsl:result-document>.

    The in-memory file system that stores MockFile instances and documents generated with <xsl:result-document>.

    Every specification uses its own in-memory file system. If you need every test to have its own in-memory file system, use the specs2 isolation argument.

    Note, however, that if you enable isolation, the stylesheet will currently also be compiled per-test rather than per-specification, because the file system needs to be instantiated before the stylesheet is compiled.

  27. def filterAttr(f: (Attr) ⇒ Boolean): (Source) ⇒ CompareMatcher

    Permalink

    Create a function that takes a Source and returns a CompareMatcher that filters attributes according to the given predicate.

    Create a function that takes a Source and returns a CompareMatcher that filters attributes according to the given predicate.

    For filtering elements and other node types, use filterNode.

    Example:

    // Apply templates for x, ignore differences in the @id attribute.
    applying(<x/>) must produce(<y/>)(filterAttr(!XPath.matches("@id", _))
  28. def filterNode(f: (Node) ⇒ Boolean): (Source) ⇒ CompareMatcher

    Permalink

    Create a function that takes a Source and returns a CompareMatcher that filters nodes according to the given predicate.

    Create a function that takes a Source and returns a CompareMatcher that filters nodes according to the given predicate.

    For filtering attributes, use filterAttr.

    Example:

    // Apply templates for a, ignore differences in the d children of c.
    applying(<a><b/></a>) must produce(<c/>)(filterNode(!XPath.matches("c/d", _))
  29. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  31. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  32. val inputSchema: Option[Builder]

    Permalink

    The XML Schema to use for validating the input XML and loading default attributes

    The XML Schema to use for validating the input XML and loading default attributes

    Example:

    import org.xmlunit.builder.Input
    
    override val inputSchema = Some(Input.fromFile("schema.xsd"))
  33. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  34. implicit def matcher: (Source) ⇒ CompareMatcher

    Permalink

    A function that takes a Source and returns a CompareMatcher that compares the given Source to an XML fragment.

    A function that takes a Source and returns a CompareMatcher that compares the given Source to an XML fragment.

    You can extend the default matcher by by overriding it in your specification:

    class MySpecification extends mutable.Specification with XsltSpecification {
        ...
    
        // A matcher that ignores @id attributes when comparing elements.
        override implicit def matcher = (s: Source) => defaultMatcher(s).withAttributeFilter(
            filter[Attr](a => a.getName != "id")
        )
    
        ...
    }

    You can also use a different matcher for a single test:

    "Ignore an attribute" in {
        // Define a custom matcher for this test only.
        val m = (s: Source) => defaultMatcher(s).withAttributeFilter(
        // Ignore any attribute called "ignore-me".
            filter[Attr](a => a.getName != "ignore-me")
        )
    
        // Pass in the custom matcher.
        applying(<x/>) must produce(<y/>)(m)
    }
  35. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. val parameters: Map[QName, XdmValue]

    Permalink

    Global stylesheet parameters.

    Global stylesheet parameters.

    You can either supply a Map[QName, XdmValue] or call asMap on a sequence of tuples:

    scala> asMap("string" -> "foo", "int" -> 1, "uri" -> new URI("http://www.google.com"))
    res2: Map[QName, XdmItem] = Map(string -> foo, int -> 1, uri -> http://www.google.com)
  39. def pi(pi: ProcInstr): XdmNode

    Permalink

    Convert a ProcInstr into an XdmNode processing-instruction() node.

  40. final val processor: Processor

    Permalink

    The Saxon Processor to use for running the stylesheet.

    The Saxon Processor to use for running the stylesheet.

    By default, it is configured to use the in-memory file system and an XML parser that can use XML catalogs.

  41. def produce(any: Any*)(implicit matcher: (Source) ⇒ CompareMatcher): Matcher[Transformation]

    Permalink
    Definition Classes
    XsltResultMatchers
  42. def produce(result: ⇒ Vector[Any])(implicit matcher: (Source) ⇒ CompareMatcher): Matcher[Transformation]

    Permalink

    Create a matcher that compares the supplied arguments against the result of an XML transformation.

    Create a matcher that compares the supplied arguments against the result of an XML transformation.

    Example use:

    class MySpecification extends mutable.Specification with XsltSpecification {
        val stylesheet = XSLT.file("my-stylesheet.xsl")
    
        "Convert a into b" in {
            // Apply the templates for the  element in the XSLT stylesheet and check the result.
            applying { <a>foo</a> } must produce { <b>foo</b> }
        }
    }
    Definition Classes
    XsltResultMatchers
  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  44. def text(data: String): XdmNode

    Permalink

    Convert a String into an XdmNode text() node.

    Convert a String into an XdmNode text() node.

    If you have a function that expects a text node parameter, call this method with a string argument to create a text node, then pass it to your function.

  45. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  46. def transformer: Xslt30Transformer

    Permalink

    Get a new Xslt30Transformer instance for the compiled stylesheet.

    Get a new Xslt30Transformer instance for the compiled stylesheet.

    Any global parameters you set are set when this method is called.

  47. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. lazy val xpathCompiler: XPathCompiler

    Permalink
    Definition Classes
    XsltSpecificationXPathSupport
  51. lazy val xsltCompiler: XsltCompiler

    Permalink
    Definition Classes
    XsltSpecificationXsltSupport

Inherited from XsltSupport

Inherited from XPathSupport

Inherited from XsltResultMatchers

Inherited from AnyRef

Inherited from Any

Ungrouped