[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: parse multilanguage XML-file

Subject: RE: parse multilanguage XML-file
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Wed, 5 Mar 2003 13:35:05 -0000
multilanguage xml
Hi,

I'm guessing (without seeing the whole stylesheet), but I think because you dont have a template to match the root, the default template is being applied and will therefore apply-templates to both <lang> elements (eventually) - which fires the template matching <section> when you dont expect it to.

To only apply-templates to the <lang> of your choice, add a template matching the root and apply-templates specifically to that element:

<xsl:template match="/">
  <xsl:apply-tempaltes select="/page/pagecontent/lang[@name='de']"/>
</xsl:template>


cheers
andrew

> -----Original Message-----
> From: jm [mailto:mailinglist@xxxxxxxxxxxxxx]
> Sent: 05 March 2003 13:23
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  parse multilanguage XML-file
> 
> 
> hi,
> 
> i have problems parsing my multilanguage XML file.
> 
> here is a short outline of the XML file:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <page>
> <pagecontent>
> 	<lang name="de">
> 		<section>
> 			......
> 			<!--
> 				here comes for example the 
> complete german content of
> 				this file
> 			-->
> 
> 		</section>
> 	</lang>
> 
> 	<lang name="en">
> 		<section>
> 			......
> 		</section>
> 	</lang>
> </pagecontent>
> </page>
> 
> 
> now i want to match _only_ on of the language parts
> 
> so my first tamplate-match is 
> 
> <xsl:template match="/page/pagecontent/lang[@name='de']">
>   <html>
>   	<body>
> 		      <xsl:apply-templates/>    <----------------+
> 	</body>							
> 	   |
>   </html>							
> 	     |
>   </xsl:template>						
> 	  |
> 								
> 		|
> how can apply my following tamplates only on child-nodes of  
> /page/pagecontent/lang[@name='de']
> and _ignore_ all other language-nodes.
> 
> one of the folowing templates is
> 
> <xsl:template match="section">
> 		<xsl:value-of select="@title"/>
> 		<hr/>
>   		...
> </xsl:template>
> 
> and i want to apply this template only on child-nodes of the 
> chosen language-node.
> 
> thanks
> jm
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.458 / Virus Database: 257 - Release Date: 24/02/2003
>  
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.458 / Virus Database: 257 - Release Date: 24/02/2003
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • parse multilanguage XML-file
    • jm - Wed, 5 Mar 2003 08:04:30 -0500 (EST)
      • <Possible follow-ups>
      • Andrew Welch - Wed, 5 Mar 2003 08:32:09 -0500 (EST) <=
        • jm - Wed, 5 Mar 2003 09:08:58 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.