|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [Fwd: Re: Re: Using a variable in XSLT]
Hi, I am still needing your help. I want to transform a xsd file that contains documentation in multiple languages. Source Example
<xs:element name="account" type="Account">
<xs:annotation>
<xs:documentation xml:lang="en">This is the English general description
<sys:one>That's the special purpose description for system 1</sys:one>
<sys:two>That's the special purpose description for system 2</sys:two>
</xs:documentation>
<xs:documentation xml:lang="de">Das ist die deutsche allgemeneine Beschreibung.
<sys:one>Das ist die spezielle Beschreibung für System 1</sys:one>
<sys:two>Das ist die spezielle Beschreibung für System 2</sys:two> </xs:documentation>
</xs:annotation>
</xs:element>I would like to be able to choose a language. Such that all documentation elements but those in the selected language are erased. I also would like to be able to choose a sys. Such that only the selected sys is present in the output.
Currently my stylesheet that only gets part of the result looks like this. Thanks in advance TMS <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sys="http://www.you-know-who.com/2003/systems" version="1.0"> <xsl:param name="SystemSelected" select="'sys:ARTS'" /> <xsl:param name="lang" select="'de'" /> <xsl:output method="xml" indent="yes"/> <xsl:template match='/'> <xsl:apply-templates/> </xsl:template> <!-- This is to take out the documentation in all but the selected language -->
<!-- Would be nice to use a variable here -->
<xsl:template match="//xs:annotation/xs:documentation[not(lang('de'))]" priority="2"/>
<!-- This is to select the SelectedLanguage and the SelectedSystem and to take it one level higher --><!-- This doesn't deliver the expected result. In particular because xs:documentation is not present in the output anymore --> <xsl:template match="//xs:annotation/xs:documentation"> <xsl:apply-templates select="self::*[lang($lang)]/*[name()=$SystemSelected]"/> </xsl:template>
</xsl:stylesheet> Regards XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








