Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL FO: Is left to right text so hard?!

Status
Not open for further replies.

thenewa2x

Programmer
Dec 10, 2002
349
0
0
US
I spent quite a few hours searching through Google, W3, and other sites and I cannot figure out why my text is being displayed backwards. Everything is backwards except one element called <tt>sectioncontent</tt>.

Here is the XSL FO document:
Code:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL]
                xmlns:fo="[URL unfurl="true"]http://www.w3.org/1999/XSL/Format"[/URL]
                xmlns:xse="[URL unfurl="true"]http://www.syntext.com/Extensions/XSLT-1.0"[/URL]
                xmlns:se="[URL unfurl="true"]http://syntext.com/XSL/Format-1.0"[/URL]
                version='1.0'>
                
  <!--
  
  ====================================================================
  
                          Page Configuration
  
  ====================================================================
  
  -->
  
  <xsl:template match="/">
    <fo:root>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="Letter"
                               margin="0.4in"
                               page-height="11in"
                               page-width="8.5in"
                               writing-mode="lr-tb">
          <fo:region-body writing-mode="lr-tb" />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="Letter">
        <fo:flow flow-name="xsl-region-body">
          <xsl:apply-templates />
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                            Global Template
  
  ====================================================================
  
  -->
  
  <xsl:template match="*">
    <fo:block font-size="10pt">
      <xsl:apply-templates />
    </fo:block>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                           Titles and Labels
  
  ====================================================================
  
  -->
  
  <!-- Title Template -->
  <xsl:template match="title">
    <fo:block font-size="24pt"
              font-weight="bold"
              padding-bottom="10pt">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!-- Author Label Template -->
  <xsl:template match="authorslabel">
    <fo:block font-weight="bold">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!-- Reviewers Label Template -->
  <xsl:template match="reviewerslabel">
    <fo:block font-weight="bold">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!-- Section Label Template -->
  <xsl:template match="sectionlabel">
    <fo:block font-weight="bold"
              font-size="18pt"
              padding-bottom="5pt">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!-- Red Section Label Template -->
  <xsl:template match="sectionlabelred">
    <fo:block font-weight="bold"
              font-size="18pt"
              color="#FF0000"
              padding-bottom="5pt">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!-- List Label Template -->
  <xsl:template match="list1label">
    <fo:block font-weight="bold"
              padding-bottom="5pt">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!-- Reference Label Template -->
  <xsl:template match="referenceslabel">
    <fo:block font-weight="bold"
              font-size="12pt">
      <xsl:value-of select="." />
    </fo:block>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                            Document Sections
  
  ====================================================================
  
  -->
  
  <!-- Section Content Template -->
  <xsl:template match="sectioncontent">
    <fo:block padding-bottom="10pt">
      <xsl:apply-templates />
    </fo:block>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                                 Lists
  
  ====================================================================
  
  -->
  
  <!-- Author List Template -->
  <xsl:template match="authorslist">
    <fo:list-block padding-bottom="5pt">
      <xsl:for-each select="./author">
        <fo:list-item padding-bottom="2pt">
          <fo:list-item-label>
            <fo:inline padding-left="5pt">
              <xsl:text>-</xsl:text>
            </fo:inline>
          </fo:list-item-label>
          <fo:list-item-body>
            <fo:inline padding-left="10pt">
              <xsl:value-of select="." />
            </fo:inline>
          </fo:list-item-body>
        </fo:list-item>
      </xsl:for-each>
    </fo:list-block>
  </xsl:template>
  
  <!-- Reviewer List Template -->
  <xsl:template match="reviewerslist">
    <fo:list-block padding-bottom="5pt">
      <xsl:for-each select="./reviewer">
        <fo:list-item padding-bottom="2pt">
          <fo:list-item-label>
            <fo:inline padding-left="5pt">
              <xsl:text>-</xsl:text>
            </fo:inline>
          </fo:list-item-label>
          <fo:list-item-body>
            <fo:inline padding-left="10pt">
              <xsl:value-of select="./reviewername" />
            </fo:inline>
            <fo:inline>
              <xsl:value-of select="./reviewertitle" />
            </fo:inline>
          </fo:list-item-body>
        </fo:list-item>
      </xsl:for-each>
    </fo:list-block>
  </xsl:template>
  
  <!-- Reference List Template -->
  <xsl:template match="referenceslist">
    <fo:list-block padding-bottom="5pt">
      <xsl:for-each select="./reference">
        <fo:list-item padding-bottom="2pt">
          <fo:list-item-label>
      <fo:inline font-family="Webdings"
                 font-size="6pt"
                 padding-bottom="5pt"
                 padding-right="5pt">
       <xsl:text se:is-editable="false">=</xsl:text>
      </fo:inline>
          </fo:list-item-label>
          <fo:list-item-body>
            <fo:inline padding-left="10pt">
              <xsl:value-of select="." />
            </fo:inline>
          </fo:list-item-body>
        </fo:list-item>
      </xsl:for-each>
    </fo:list-block>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                           Lists 1 Templates
  
  ====================================================================
  
  -->
  
  <!-- List 1 Template -->
  <xsl:template match="list1|list1red">
    <fo:block padding-bottom="5pt"
              start-indent="10pt">
      <xsl:apply-templates />
    </fo:block>
  </xsl:template>
  
  <!-- List 1 Label Item -->
  <xsl:template match="list1label">
    <fo:inline font-family="Webdings"
               font-size="10.5pt"
               padding-bottom="5pt"
               padding-right="3pt">
     <xsl:text se:is-editable="false">4</xsl:text>
    </fo:inline>
    <fo:inline font-weight="bold"
               font-size="12pt"
               padding-bottom="5pt">
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!-- List 1 Item -->
  <xsl:template match="list1item">
    <fo:block>
      <fo:inline font-family="Webdings"
                 font-size="10.5pt"
                 padding-bottom="5pt">
       <xsl:text se:is-editable="false">4</xsl:text>
      </fo:inline>
      <fo:inline padding-bottom="5pt">
        <xsl:value-of select="." />
      </fo:inline>
    </fo:block>
  </xsl:template>
  
  <!-- List 1 Red Item -->
  <xsl:template match="list1itemred|list1reditem">
    <fo:block>
      <fo:inline font-family="Webdings"
                 font-size="10.5pt"
                 padding-bottom="5pt"
                 color="#FF0000">
       <xsl:text se:is-editable="false">4</xsl:text>
      </fo:inline>
      <fo:inline padding-bottom="5pt"
                 color="#FF0000">
        <xsl:value-of select="." />
      </fo:inline>
    </fo:block>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                           Lists 2 Templates
  
  ====================================================================
  
  -->
  
  <!-- List 2 Template -->
  <xsl:template match="list2">
    <fo:block padding-bottom="5pt"
              start-indent="20pt">
      <xsl:apply-templates />
    </fo:block>
  </xsl:template>
  
  <!-- List 2 Label Item -->
  <xsl:template match="list2label">
    <fo:inline font-family="Webdings"
               font-size="10.5pt"
               padding-bottom="5pt"
               padding-right="3pt">
     <xsl:text se:is-editable="false">4</xsl:text>
    </fo:inline>
    <fo:inline font-weight="bold"
               font-size="12pt"
               padding-bottom="5pt">
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!-- List 2 Item -->
  <xsl:template match="list2item">
    <fo:block>
      <fo:inline font-family="Webdings"
                 font-size="6pt"
                 padding-bottom="5pt"
                 padding-right="5pt">
       <xsl:text se:is-editable="false">=</xsl:text>
      </fo:inline>
      <fo:inline padding-bottom="5pt">
        <xsl:value-of select="." />
      </fo:inline>
    </fo:block>
  </xsl:template>
  
    <!-- List 2 Red Item -->
  <xsl:template match="list2itemred">
    <fo:block>
      <fo:inline font-family="Webdings"
                 font-size="6pt"
                 padding-bottom="5pt"
                 padding-right="5pt"
                 color="#FF0000">
       <xsl:text se:is-editable="false">=</xsl:text>
      </fo:inline>
      <fo:inline padding-bottom="5pt"
                 color="#FF0000">
        <xsl:value-of select="." />
      </fo:inline>
    </fo:block>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                          Global Inline Elements
  
  ====================================================================
  
  -->
  
  <!-- Document Reference Template -->
  <xsl:template match="refdocname">
    <fo:inline>
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!-- External Document Template -->
  <xsl:template match="externaldocurl">
    <fo:inline text-decoration="underline">
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!-- Subscript Template -->
  <xsl:template match="sub">
    <fo:inline baseline-shift="sub"
               font-size="8pt">
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!-- Superscript Template -->
  <xsl:template match="sup">
    <fo:inline baseline-shift="sup"
               font-size="8pt">
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!-- Italics Template -->
  <xsl:template match="italics">
    <fo:inline font-style="italic">
      <xsl:value-of select="." />
    </fo:inline>
  </xsl:template>
  
  <!--
  
  ====================================================================
  
                          Document Information
  
  ====================================================================
  
  -->
  
  <!-- Date Template -->
  <xsl:template match="date">
    <fo:block>
      <fo:inline font-weight="bold">
        <xsl:text se:is-editable="false">Date: </xsl:text>
      </fo:inline>
      <fo:inline padding-left="4pt">
        <xsl:value-of select="." />
      </fo:inline>
    </fo:block>
  </xsl:template>
  
  <!-- Accession Number Template -->
  <xsl:template match="accession">
    <fo:block>
      <fo:inline font-weight="bold">
        <xsl:text se:is-editable="false">Accession #: </xsl:text>
      </fo:inline>
      <fo:inline padding-left="4pt">
        <xsl:value-of select="." />
      </fo:inline>
    </fo:block>
  </xsl:template>
  
</xsl:stylesheet>

And here is a sample document:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE qld PUBLIC "-//Cinahl//DTD Quick Lesson v2.1 XML//EN" "quick/valid.dtd">
<qld>
  <title>!?ereh no gniog si tahW</title>
  <sidematter>
    <authors>
      <authorslabel>sdrawkcab osla si sihT</authorslabel>
      <authorslist>
        <author>
          <authorname>.oot eno sihT</authorname>
        </author>
      </authorslist>
    </authors>
    <reviewers>
      <reviewerslabel>.eno siht dnA</reviewerslabel>
      <reviewerslist>
        <reviewer>
          <reviewername>.siht dnA</reviewername>
          <reviewertitle/>
          <reviewerposition/>
          <revieweraffiliation/>
          <reviewerlocation/>
        </reviewer>
      </reviewerslist>
    </reviewers>
  </sidematter>
  <body>
    <sections>
      <section>
        <sectionlabel>!sihT dnA</sectionlabel>
        <sectioncontent>But not this for some reason.</sectioncontent>
      </section>
    </sections>
  </body>
  <references>
    <referenceslabel/>
    <referenceslist>
      <reference>...oot sihT</reference>
    </referenceslist>
  </references>
  <date>.siht dnA</date>
  <accession>.siht dnA</accession>
</qld>

Also if you have Syntext's Serna editor, you'll see what I mean. You can't even edit the line after you save it and close it.

---------------------------------------
TINSTAAFL, which is why I contribute.
 
Lol, when I input in Serna, it's backwards.

---------------------------------------
TINSTAAFL, which is why I contribute.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top