2017 R1

ExportPermanent link for this heading

Simple Export ExamplePermanent link for this heading

The values of an exported Fabasoft Folio object can be accessed via XPath expressions. The following example has already been used in chapter “Getting Started” to export the name of an object.

Example

export.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<!-- the name of the object is exported -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sys="http://www.fabasoft.com/components/COOSYSTEM@1.1">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
   omit-xml-declaration="no" />
  <xsl:template match="/">
    <root>
      <objname>
        <xsl:value-of select="*/sys:objname" />
      </objname>
    </root>
  </xsl:template>
</xsl:stylesheet>

Explanation:

  • xmlns:sys="http://www.fabasoft.com/components/COOSYSTEM@1.1"
    Defines the sys namespace to make component objects from COOSYSTEM@1.1 accessible with this prefix.
  • <xsl:template match="/">
    The template matches the root node (“/”) that contains the exported object as child.
  • <xsl:value-of select="*/sys:objname" />
    * selects all children of the current node. The current node is the root node (as defined by the match="/" statement). The root node has only one child, the exported object. xsl:value-of prints out the value of COOSYSTEM@1.1:objname of the exported object.

The result XML file looks like this:

Result

result.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
  <objname>My Object</objname>
</root>

Data TypesPermanent link for this heading

How to access the data of properties depends on the data types of the properties.

Data Type

XSLT Example

Result Example

string

<xsl:value-of select="*/sys:objname" />

my string

integer

<xsl:value-of select="*/sys:objactversnr" />

13

float

<xsl:value-of select="*/term:averagescore" />

3.49

boolean

<xsl:value-of select="*/sys:objversnopurge" />

0

datetime

<xsl:value-of select="*/sys:objactverscreated" />

2011-08-10T
12:12:13

object
pointer

<xsl:value-of select="*/sys:objcreatedby/sys:usersurname"/>

Jones

enumeration

<xsl:value-of select="*/folio:perssex" />

2

compound

<xsl:value-of select="*/sys:objlock/sys:objlocked" />

0

currency

<xsl:value-of select="*/my:sum/sys:currsymbol" />
<xsl:value-of select="*/my:sum/sys:currvalue" />

4
39000

list data types

<xsl:for-each select="*/sys:objchildren">
  
<xsl:value-of select="sys:objname" />
</xsl:for-each>

Pictures
Documents

Further explanations:

  • If the property has no value an empty string is returned. If a part of the XPath has no value, an empty string is returned for the whole XPath.
  • Boolean properties return “0” if false, “1” if true and an empty string if undefined.
  • Properties of objects referenced in object pointers can be accessed via XPath expressions.
  • To each Fabasoft Folio enumeration entry an integer value is assigned. Enumerations return the integer value of the selected enumeration entry.
  • Properties of compound types can be accessed via XPath expressions.
  • Currency consists of two properties. The property currvalue contains the value. The enumeration currsymbol contains the currency symbol.
    Note: In some cases it might be useful to replace the integer enumeration value with the enumeration reference (“USD” instead of “0”, or “EUR” instead of “1” and so on). An example on how to achieve this can be found in chapter “sys:Evaluate”).
  • For the data types also corresponding list data types exist. Lists may be looped with xsl:for-each or entries can be accessed by specifying the index:
    <xsl:value-of select="*/sys:objchildren[1]" /> (returns the first entry in the list)