xsl-list
[Top] [All Lists]

Re: [xsl] Using xsl:key

2006-11-30 20:01:14
David,

Thanks for responding! I will provide more
information.

The way I have it setup is as follows:


I am going to call this XML snippet the master XML
because it calls the other language spaecific XMLs.
This is because I want one PDF output with all
languages.

<====master.xml=====>
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="PCALetters.xsl"
type="text/xsl"?>
<!DOCTYPE RegLetter PUBLIC "-//SE Inc//DTD Regulatory
Letters XML//EN" "letters.dtd" [
<!ENTITY T11-30-06S030132023_EN SYSTEM
"T11-30-06S030132023-EN.xml">
<!ENTITY T11-30-06S030132023_DE SYSTEM
"T11-30-06S030132023-DE.xml">
<!ENTITY T11-30-06S030132023_FR SYSTEM
"T11-30-06S030132023-FR.xml">
<!ENTITY T11-30-06S030132023_IT SYSTEM
"T11-30-06S030132023-IT.xml">
]>

<RegLetter docpartnum="T11-30-06S" watermark="no"
status="preview">
   <Stuffer>
     <docinfo>
       <SEIlogo>
         <figureprint>
           <graphic fileref="seilogo.eps"/>
         </figureprint>
       </SEIlogo>
       <madeIn>Made in </madeIn>
       <copyright>&copy; Copyright...</copyright>
       <printedIn>Printed in </printedIn>
       <address>
         <addressline>B...4800 Harbor
Street...</addressline>
        </address>
     </docinfo>
&T11-30-06S030132023_EN;
&T11-30-06S030132023_DE;
&T11-30-06S030132023_FR;
&T11-30-06S030132023_IT;
  </Stuffer>
</RegLetter>

</====master.xml=====>

This is a snippet of the English XML file (first
output in the PDF)
<=====T11-30-06S030132023-EN.xml=====>

<?xml version="1.0" encoding="iso-8859-1"?>
<lang type="EN">
   <infogroup>
      <fixedterms>
        <term id="caution" text="CAUTION"/>
        <term id="warning" text="WARNING"/>
        <term id="notice" text="NOTICE"/>
         ...
      </fixedterms>
    </infogroup>
    ...
      <warning><para>Missing translation...(Testing
Warning)</para></warning>...
</lang>
</=====T11-30-06S030132023-EN.xml=====>

German XML snippet (2nd output in the PDF) 
<=====T11-30-06S030132023-DE.xml=====>

<?xml version="1.0" encoding="iso-8859-1"?>
<lang type="DE">
   <infogroup>
     <fixedterms>
       <term id="caution" text="WARNHINWEIS"/>
       <term id="warning" text="WARNUNG"/>
       <term id="notice" text="HINWEIS"/>
       ...
     </fixedterms>
   </infogroup>
   ...
     <warning><para>Missing translation...(Testing
Warning)</para></warning>...
</lang>
</=====T11-30-06S030132023-DE.xml=====>

French XML snippet (3rd output in the PDF) 
<=====T11-30-06S030132023-FR.xml=====>

<?xml version="1.0" encoding="iso-8859-1"?>
<lang type="FR">
   <infogroup>
     <fixedterms>
        <term id="caution" text="ATTENTION"/>
        <term id="warning" text="AVERTISSEMENT"/>
        <term id="notice" text="REMARQUE"/>
        ...
     </fixedterms>
   </infogroup>
   ...
     <warning><para>Missing translation...(Testing
Warning)</para></warning>...
</lang>
</=====T11-30-06S030132023-FR.xml=====>


Italian XML snippet (4th output in the PDF) 
<=====T11-30-06S030132023-IT.xml=====>

<?xml version="1.0" encoding="iso-8859-1"?>
<lang type="IT">
   <infogroup>
      <fixedterms>
         <term id="caution" text="ATTENZIONE"/>
         <term id="warning" text="AVVERTENZA"/>
         <term id="notice" text="AVVISO"/>
         ...
      </fixedterms>
    </infogroup>
    ...
      <warning><para>Missing translation...(Testing
Warning)</para></warning>...
</lang>
</=====T11-30-06S030132023-IT.xml=====>

There are more languages with the same concept.

Here is the XSL Snippet:

<!--This is declared at the top of the FO style
sheet-->
<xsl:key name="terms" match="term" use="@id"/>
  <xsl:template match="/">

<xsl:template match="warning">
  <fo:block text-align="center">
     <fo:table border-style="solid" border-width="1pt"
space-after="2.5mm">
       <fo:table-column column-width="75%"/>
       <fo:table-body>
         <fo:table-row>
           <fo:table-cell padding-top="2mm">
             <fo:block text-align="center"
font-weight="bold">
                <fo:external-graphic
content-width=".3in" src="warning.eps"/>                    
                
                <xsl:for-each
select="key('terms','warning')">
                   <xsl:text>&#160;</xsl:text>
                   <xsl:value-of select="@text"/>
                </xsl:for-each>
             </fo:block>
           </fo:table-cell>
         </fo:table-row>
         <fo:table-row>  
           <fo:table-cell padding-top="2mm"
padding-bottom="2mm" text-align="justify"
font-weight="bold"
start-indent="2mm" end-indent="2mm">
              <fo:block>
                <xsl:apply-templates/>
              </fo:block>
           </fo:table-cell>
         </fo:table-row>
       </fo:table-body>
     </fo:table>
  </fo:block>
</xsl:template>

Thanks again!

Siarom
--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


you don't show enough of your input to really help. 
In particular,
where do you have the entity references?  (you show
them appearng
immediately after the entity declaration, but that
presumably isn't
where they appear. Also where in the XML do you
record which are the
german texts and which are the english ones?  The
entity names end in
_DE and _EN but entities are expanded _before_ XSLT
starts, they are
just a macro pre-processor syntax. So XSLT just sees
the XML that
results from expanding the entities and never sees
the entity names.

So, somewhere in your source xml or your stylesheet
you must have a
syntax that specifies which language you want, and
somewhere in your xml
that holds the language texts, you must have some
syntax to say which
language it is for. The details of what XSLT you use
to tie these
together depend on the details of where the
information is specified,
but you haven't given any information.

David


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





 
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>