p:os-info (3.1) 

Returns information about the operating system.

Summary

<p:declare-step type="p:os-info">
  <output port="result" primary="true" content-types="application/xml" sequence="false"/>
</p:declare-step>

The p:os-info step returns information about the operating system the XProc processor is running on, which appears on the result port as an XML document.

Ports:

Port

Type

Primary?

Content types

Seq?

Description

result

output

true

application/xml

false

A <c:result> element describing properties of the operating system. See The result document for more information.

Description

The p:os-info step gathers information about the operating system the XProc processor is running on. This results in an XML document on the result port.

The result document

The document appearing on the result port has a <c:result> root element (the c prefix here is bound to the http://www.w3.org/ns/xproc-step namespace).

Basic information is contained in a number of mandatory attributes. XProc processors may add other attributes with operating system information, but these are, of course, implementation-defined and therefore depend on the XProc processor used. Attribute values can be the empty string if they do not apply to the runtime environment (which will rarely happen).

Environment variables are listed in <c:environment> child elements.

<c:result cwd
          file-separator
          os-architecture
          os-name
          os-version
          path-separator
          user-home
          user-name
          *? >
  <c:environment name="…" value="…">*
</c:result>

 

Attribute

#

Description

cwd

1

The current working directory (in operating system dependent notation). For instance C:\user\erik\data\bin.

file-separator

1

The file/path separator character. For instance / on Unix or \ on Windows.

os-architecture

1

The operating system architecture. For instance i386.

os-name

1

The name of the operating system. For instance Mac OS X or Windows 10.

os-version

1

The version of the operating system. For instance 10.0.

path-separator

1

The path separator character. For instance : on Unix or ; on Windows.

user-home

1

The home directory of the current user (in operating system dependent notation). For instance C:\user\erik\data.

user-name

1

The (login) name of the current user. For instance erik

*

?

The XProc processor may add other attributes with information about the operating system (in a different namespace). These attributes, their values and meaning are implementation-defined and therefore depend on the XProc processor used.

 

Child element

#

Description

c:environment name="…" value="…"

*

Name and value of an environment variable.

Examples

Basic usage

Pipeline document:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">

  <p:output port="result"/>

  <p:os-info/>
  
</p:declare-step>

On the system used to develop the XProcRef site on, the partial result is:

<c:result xmlns:c="http://www.w3.org/ns/xproc-step"
          os-name="Windows 10"
          user-home="C:\Users\erik"
          file-separator="\"
          user-name="erik"
          path-separator=";"
          os-version="10.0"
          cwd="C:\…"
          os-architecture="amd64">
   <c:environment name="…" value="…"/>
</c:result>

Some information (especially the names and values of the environment variables) is left out for privacy reasons.

Additional details

  • The document appearing on the result port only has a content-type property. It has no other document-properties (also no base-uri).

Reference information

This description of the p:os-info step is for XProc version: 3.1. This is a non-required step (an XProc 3.1 processor does not have to support this).

The formal specification for the p:os-info step can be found here.

The p:os-info step is part of categories:

The p:os-info step is also present in version: 3.0.