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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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
(Deleted User) Subject: xslt sort help
Author: (Deleted User)
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

   
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.