<?xml version="1.0" encoding="UTF-8"?>
<Layout xmlns="urn:speedata.de:2009/publisher/en" xmlns:sd="urn:speedata:2009/publisher/functions/en">
  <Trace grid="no" gridallocation="no" objects="no"/>

  <LoadFontfile name="Helvetica" marginprotrusion="100" filename="texgyreheros-regular.otf"/>
  <LoadFontfile name="Helvetica Fett" filename="texgyreheros-bold.otf"/>
  <LoadFontfile name="Helvetica Kursiv" filename="texgyreheros-italic.otf"/>
  <LoadFontfile name="Helvetica Fett Kursiv" filename="texgyreheros-bolditalic.otf"/>


  <DefineFontfamily name="Überschrift" fontsize="12" leading="16">
    <Regular fontface="Helvetica"/>
    <Bold fontface="Helvetica Fett"/>
    <BoldItalic fontface="Helvetica Fett Kursiv"/>
    <Italic fontface="Helvetica Kursiv"/>
  </DefineFontfamily>

  <DefineFontfamily name="text" fontsize="12" leading="13">
    <Regular fontface="Helvetica"/>
    <Bold fontface="Helvetica Fett"/>
    <BoldItalic fontface="Helvetica Fett Kursiv"/>
    <Italic fontface="Helvetica Kursiv"/>
  </DefineFontfamily>

  <DefineFontfamily name="Tabelle" fontsize="10" leading="12">
    <Regular fontface="Helvetica"/>
  </DefineFontfamily>

  <Pageformat width="150mm" height="200mm"/>
  <SetGrid width="4mm" height="14pt"/>

  <DefineTextformat name="Seitenzahl rechts" alignment="rightaligned"/>
  <DefineTextformat name="text" alignment="justified"/>
  <DefineTextformat name="Text mit Einrückung" alignment="justified" indentation="2em"/>


  <Pagetype name="rechte Seite" test="sd:odd( sd:current-page() )">
    <Margin left="2cm" right="1cm" top="1cm" bottom="1cm"></Margin>
    <AtPageShipout>
      <PlaceObject column="{ sd:number-of-columns() - 3 }" row="{ sd:number-of-rows() - 1}">
        <Textblock width="3">
          <Paragraph fontface="text" textformat="Seitenzahl rechts"><Value select="sd:current-page()"></Value></Paragraph>
        </Textblock>
      </PlaceObject>
    </AtPageShipout>
  </Pagetype>

  <Pagetype name="linke Seite" test="sd:gerade( sd:current-page() )">
    <Margin left="1cm" right="2cm" top="1cm" bottom="1cm"></Margin>
    <AtPageShipout>
      <PlaceObject column="1" row="{ sd:number-of-rows() - 1 }">
        <Textblock width="3">
          <Paragraph fontface="text" textformat="rechtsbündig"><Value select="sd:current-page()"></Value></Paragraph>
        </Textblock>
      </PlaceObject>
    </AtPageShipout>
  </Pagetype>

  <!--  Wird automatisch nach <LadeDatensatzdatei...> ausgeführt,
       wenn dort Daten vorhanden sind (im zweiten Durchlauf)  -->
  <Record element="Inhaltsverzeichnis">
    <PlaceObject column="3" allocate="yes">
      <Textblock width="20" fontface="Überschrift">
        <Paragraph>
          <Value>Inhalt</Value>
        </Paragraph>
      </Textblock>
    </PlaceObject>
    <NextRow/>
    <PlaceObject column="3">
      <Textblock width="20">
        <ForAll select="Planetenverzeichnis">
          <Paragraph>
            <Value select="@name"/>
            <Value>, Seite </Value>
            <Value select="@seite"/>
          </Paragraph>
        </ForAll>
      </Textblock>
    </PlaceObject>
  </Record>

  <!--  Wurzelelement  -->
  <Record element="planeten">
    <SetVariable variable="spalte" select="2"/>
    <LoadDataset name="toc"/>
    <SetVariable variable="Inhalt"/>
    <NewPage/>

    <ProcessNode select="planet"/>

    <SaveDataset filename="toc" elementname="Inhaltsverzeichnis" select="$Inhalt"/>

  </Record>

  <Record element="planet">
    <SetVariable variable="Inhalt">
      <Copy-of select="$Inhalt"/>
      <Element name="Planetenverzeichnis">
        <Attribute name="name" select=" @name "/>
        <Attribute name="seite" select=" sd:current-page()"/>
      </Element>
    </SetVariable>

    <PlaceObject column="1">
      <Textblock width="20">
        <Bookmark select="@name" level="1"/>
        <Paragraph>
          <Value select="@name"/>
        </Paragraph>
      </Textblock>
    </PlaceObject>

    <ProcessNode select="url"/>
    <ProcessNode select="bild"/>
    <ProcessNode select="monde"/>
    <ProcessNode select="beschreibung"/>

    <NewPage></NewPage>
  </Record>

  <Record element="url">
    <PlaceObject column="{ $spalte }">
      <Textblock width="29" textformat="text" fontface="Überschrift">
        <Paragraph>
          <Value>URL: </Value>
          <A href="{string(.)}"><Value select="string(.)"/></A>
        </Paragraph>
      </Textblock>
    </PlaceObject>

  </Record>

  <Record element="bild">
    <NextRow rows="2"/>
    <PlaceObject column="{ $spalte }">
      <Image width="10" file="{.}"/>
    </PlaceObject>
  </Record>

  <Record element="monde">
    <PlaceObject column="18">
      <Textblock width="7">
        <Paragraph>
          <B>
            <Value>Monde</Value>
          </B>
        </Paragraph>
        <Ul>
          <ForAll select="mond">
            <Li><Value select="string(.)"/></Li>
          </ForAll>
        </Ul>
      </Textblock>
    </PlaceObject>
    <NextRow rows="2"/>
  </Record>

  <Record element="beschreibung">
    <PlaceObject column="{ $spalte }">
      <Textblock width="28" fontface="text" textformat="Text mit Einrückung">
        <Paragraph>
          <Value select="normalize-space(string(.))"/>
        </Paragraph>
      </Textblock>
    </PlaceObject>
  </Record>

</Layout>
