Subject: Re: [xsl] Using xsl:key From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 01 Dec 2006 11:03:23 -0500 |
<RegLetter docpartnum="T11-30-06S" watermark="no" status="preview"> <Stuffer> <docinfo> ... </docinfo>
</Stuffer> </RegLetter>
<xsl:for-each select="key('terms','warning')"> ... </xsl:for-each>
<term id="caution" text="CAUTION"/> - 'EN-caution' <term id="warning" text="WARNING"/> - 'EN-warning' <term id="notice" text="NOTICE"/> - 'EN-notice' <term id="caution" text="WARNHINWEIS"/> - 'DE-caution' <term id="warning" text="WARNUNG"/> - 'DE-warning' <term id="notice" text="HINWEIS"/> - 'DE-notice'
(probably at the top level) <xsl:param name="lang-type" select="'EN'"/> ...
(then in your template) <xsl:variable name="this-key" select="concat($lang-type,local-name())"/> ... <xsl:for-each select="key('terms',$this-key)">...</xsl:for-each>
I hope that helps, Wendell
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>© 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> </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
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL-List Guidelines, Mulberry Technologie | Thread | [xsl] Problems with XSL-FO Table, Philip Vallone |
[xsl] XSL-List Guidelines, Mulberry Technologie | Date | Re: [xsl] variable rtf as querystri, Wendell Piez |
Month |