XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
catta kSubject: xslt sort help
Author: catta k
Date: 20 Aug 2009 04:22 AM
i am completely lost with xslt (the whole lot of it) i can't give an exact question as to what i need (since i dont /know/ what i need) but i can post what the end result needs to be & what i have so far.

basically it's a translation dictionary (ie spanish to enlgish or whatever) & i have to create an output that displays the word's initial, the word, & it's translation into another language.

the desired xml output is:

<?xml version="1.0" encoding="UTF-8"?>
<Dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="task2.xsd"
from="nl"
to="es">
<translation initial="1">
<search>1984</search>
<replace>Mil novecientos ochenta y cuatro</replace>
</translation>
<translation initial="A">
<search>A Clockwork Orange</search>
<replace>La naranja mecánica</replace>
</translation>
<translation initial="A">
<search>A Few Good Men</search>
<replace>A Few Good Men</replace>
</translation>

---------------------------------------------------

the xml input document is:

<?xml version="1.0" encoding="UTF-8"?>
<Dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="task1.xsd"
from="nl"
to="es">
<dictionaryEntry>
<search>A Clockwork Orange</search>
<replace>La naranja mecánica</replace>
</dictionaryEntry>
<dictionaryEntry>
<search>A Few Good Men</search>
<replace>A Few Good Men</replace>
</dictionaryEntry>
<dictionaryEntry>
<search>A Star is Born</search>
<replace>Ha nacido una estrella</replace>
</dictionaryEntry>

--------------------------------------

the xsd the desired output document needs to be valid against is:

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- definition of simple types -->
<xsd:simpleType name="languageType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="en"/>
<xsd:enumeration value="es"/>
<xsd:enumeration value="it"/>
<xsd:enumeration value="nl"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="initialType">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="non-empty-string">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:element name="search" type="non-empty-string" />
<xsd:element name="replace" type="non-empty-string" />
<xsd:attribute name="from" type="languageType" />
<xsd:attribute name="to" type="languageType" />
<xsd:attribute name="initial" type="initialType" />

<xsd:element name="translation">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="search" />
<xsd:element ref="replace" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute ref="initial" use="required" />
</xsd:complexType>
</xsd:element>

<xsd:element name="Dictionary">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="translation" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute ref="from" use="required" />
<xsd:attribute ref="to" use="required" />
</xsd:complexType>
<xsd:unique name="searchKey">
<xsd:selector xpath="translation" />
<xsd:field xpath="search"/>
</xsd:unique>
</xsd:element>

</xsd:schema>

-----------------------------

so i need to figure out an xslt that will take the input xml & turn it into the desired output xml which is valid against the xsd..

please help...

Posttop
Alberto MassariSubject: xslt sort help
Author: Alberto Massari
Date: 02 Sep 2009 12:34 PM
Hi,
which version of Stylus Studio are you using and which XSLT processor have you selected in the Scenario Dialog?

Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.