Home Man
Today's Posts

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:
Select Section of Man Page:
Select Man Page Repository:

Linux 2.6 - man page for xmerl_xs (linux section 3erl)

xmerl_xs(3erl)			     Erlang Module Definition			   xmerl_xs(3erl)

       xmerl_xs -
	      Erlang has similarities to XSLT since both languages
	    have a functional programming approach.

       Erlang  has  similarities  to  XSLT  since  both  languages  have a functional programming
       approach. Using xmerl_xpath it is possible to write XSLT like transforms in Erlang.

       XSLT stylesheets are often used when transforming XML documents, to other XML documents or
       (X)HTML	for  presentation.  XSLT  contains quite many functions and learning them all may
       take some effort. This document assumes a basic level of understanding of XSLT.

       Since XSLT is based on a functional programming approach with pattern matching and  recur-
       sion  it  is  possible  to write similar style sheets in Erlang. At least for basic trans-
       forms. This document describes how to use the XPath implementation together  with  Erlangs
       pattern matching and a couple of functions to write XSLT like transforms.

       This  approach  is  probably  easier  for  an  Erlanger	but  if you need to use real XSLT
       stylesheets in order to "comply to the standard" there is  an  adapter  available  to  the
       Sablotron XSLT package which is written i C++. See also the Tutorial .

       built_in_rules(Fun, E) -> List

	      The default fallback behaviour. Template funs should end with:
	      template(E) -> built_in_rules(fun template/1, E) .

       select(String::string(), E) -> E

	      Extracts the nodes from the xml tree according to XPath.

	      See also: value_of/1 .

       value_of(E) -> List

	      Types  E = unknown()

	      Concatenates all text nodes within the tree.


		<xsl:template match="title">
		  <div align="center">
		    <h1><xsl:value-of select="." /></h1>


		 template(E = #xmlElement{name='title'}) ->
		   ["<div align="center"><h1>",
		     value_of(select(".", E)), "</h1></div>"]

       xslapply(Fun::Function, EList::list()) -> List

	      Types  Function = () -> list()

	      xslapply is a wrapper to make things look similar to xsl:apply-templates.

	      Example, original XSLT:

		<xsl:template match="doc/title">

	      becomes in Erlang:

		template(E = #xmlElement{ parents=[{'doc',_}|_], name='title'}) ->
		   xslapply(fun template/1, E),


					   xmerl 1.2.8				   xmerl_xs(3erl)

All times are GMT -4. The time now is 03:11 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
Show Password