EXPath

Digital Publishing Module 1.0

EXPath Candidate Module 8 November 2011

This version:
http://expath.org/spec/digi-pub/20111108
Latest version:
http://expath.org/spec/digi-pub
Editor:
Claudius Teodorescu, XML Consultant

Abstract

This proposal provides a Digital Publishing module for XPath 2.0. It defines extension functions for converting from one digital format to another, to execute various processing operations of digital documents, etc. It has been designed to be compatible with XQuery 1.0 and XSLT 2.0, as well as any other standard based on XPath 2.0.

As this is a work in progress, more details about it can be found at Digital Publishing Functions Comparison.

Table of Contents

1 Introduction
1.1 Namespace conventions
1.2 Error management
2 General Functions
2.1 The digi-pub:get-module-metadata() Function
2.1.1 The digi-pub:module-metadata element
2.2 The digi-pub:transform() Function
2.2.1 The Formats
2.2.2 The Syntax for $transformation-formula parameter
2.2.3 The digi-pub:options element
2.3 The digi-pub:get-resource-metadata() Function
2.4 The digi-pub:set-resource-metadata() Function
3 Numeric Identifiers For Publications
3.1 The digi-pub:validate-identifier() Function
3.2 The digi-pub:parse-identifier() Function

Appendices

A References
B Summary of Error Conditions


1 Introduction

This Digital Publishing module allows publishing and processing of digital documents.

1.1 Namespace conventions

The module defined by this document defines functions and elements in the namespace http://expath.org/ns/digi-pub. In this document, the digi-pub prefix, when used, is bound to this namespace URI.

Error codes are defined in the namespace http://expath.org/ns/error. In this document, err prefix, when used, is bound to this namespace URI.

1.2 Error management

Error conditions are identified by a code (a QName). When such an error condition is reached during the execution of the function, a dynamic error is thrown, with the corresponding error code (as if the standard XPath function error had been called).

2 General Functions

These are general purpose functions, for general processing of documents, regardless their formats.

2.1 The digi-pub:get-module-metadata() Function

This function is used for getting the metadata of this module. It returns the module metadata.

digi-pub:get-module-metadata() as element(digi-pub:module-metadata)
			

2.1.1 The digi-pub:module-metadata element

<digi-pub:module-metadata>
	(
	digi-pub:description,
	digi-pub:version,
	digi-pub:namespace-uri,
	digi-pub:prefix,
	digi-pub:formats
	)
</digi-pub:module-metadata>
				
  • the digi-pub:module-version child element contains module's current version number.

2.2 The digi-pub:transform() Function

This function is used to transform a document from one digital publishing format to another.

digi-pub:transform($transformation-formula as xs:string,
	$input-document as xs:anyAtomicType,
	$options as element(digi-pub:options)?) as xs:anyAtomicType*
			
  • $transformation-formula is the formula used to specify the source format and the target format. These formulae are detailed below. If the transformation formula is not supported, this is an error [err:DPUB001].

  • $input-document is the document to be transformed from source format to target format.

  • $options are the options for the current operation.

2.2.1 The Formats

Below are the input/output formats:

pdf (Portable Document Format), html (Hypertext Markup Language), txt (Plain Text), epub (Open eBook), rtf (Rich Text Format), docbook (DocBook), xslfo (Extensible Stylesheet Language Formatting Objects), pptx (PowerPoint Open XML Presentation), svg (Scalable Vector Graphics).

2.2.2 The Syntax for $transformation-formula parameter

The syntax for $transformation-formula parameter is as follows:

$input-format-to-$output-format
			

If the syntax of the transformation formula is wrong, this is an error [err:DPUB004].

If neither the input format, or output format is supported, this is an error [err:DPUB001].

2.2.3 The digi-pub:options element

<digi-pub:options>
	(digi-pub:multiple-output?)
</digi-pub:options>
				
  • the digi-pub:multiple-output child element controls if the output is as more than one documents (for value true) or as one document (for value false). The default value is false.

2.3 The digi-pub:get-resource-metadata() Function

This function is used for getting the metadata of a resource. It returns the resource metadata.

digi-pub:get-resource-metadata($resource-path as xs:string) as element(digi-pub:resource-metadata)
			
  • $resource-path is the path of the resource. If the path is not correct, this is an error [err:DPUB002]. If the user has no rights to access the path, this is an error [err:DPUB003].

2.4 The digi-pub:set-resource-metadata() Function

This function is used for setting the metadata of a resource. It returns true if successfully completed, false if not.

digi-pub:set-resource-metadata($resource-path as xs:string,
	$new-resource-metadata as element(digi-pub:resource-metadata) as xs:boolean
			
  • $resource-path is the path of the resource. If the path is not correct, this is an error [err:DPUB002]. If the user has no rights to access the path, this is an error [err:DPUB003].

  • $new-resource-metadata is the new resource metadata.

3 Numeric Identifiers For Publications

These are functions for validation and conversion of numeric identifiers for publications. The numeric identifiers can be of type ISBN, ISSN, and DOI.

3.1 The digi-pub:validate-identifier() Function

This function is used for validating the publication's numeric identifier. It returns true if successfully completed, false if not.

digi-pub:validate-identifier($identifier as xs:string) as xs:boolean
			
  • $identifier is the publication's numeric identifier.

3.2 The digi-pub:parse-identifier() Function

This function is used for parsing the publication's numeric identifier. It returns digi-pub:identifier element, whose content varies according to the identifier, as it is detailed below.

digi-pub:parse-identifier($identifier as xs:string) as element(digi-pub:identifier)
			
  • $identifier is the publication's numeric identifier.

A References

XPath 3.0
XML Path Language (XPath) 3.0. Jonathan Robie, Don Chamberlin, Michael Dyck, John Snelson, editors. W3C Working Draft, 13 December 2011.
XSLT 3.0
XSL Transformations (XSLT) Version 3.0. Michael Kay, editor. W3C Working Draft, 10 July 2012.
XQuery 3.0
XQuery 3.0: An XML Query Language. Jonathan Robie, Don Chamberlin, Michael Dyck, John Snelson, editors. W3C Working Draft, 13 December 2011.
XPath and XQuery Functions and Operators 3.0
XPath and XQuery Functions and Operators 3.0. Michael Kay, editor. W3C Working Draft, 13 December 2011.
XQuery and XPath Data Model 3.0
XQuery and XPath Data Model 3.0. Norman Walsh, Anders Berglund, John Snelson, editors. W3C Working Draft, 13 December 2011.

B Summary of Error Conditions

err:DPUB001
err:DPUB001: The transformation formula is not supported.
err:DPUB002
err:DPUB002: The remote resource does not exist.
err:DPUB003
err:DPUB003: The user has no rights to access the remote resource.
err:DPUB004
err:DPUB004: The syntax of the transformation formula is wrong.