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)
-> - Stylus Studio - Registrar en o... (1)
-> + Stylus Studio - Registrar en o... (2)
-> + Can a pipeline send a file by ... (2)
-> + After Updateing WIN10 to WIN11... (12)
-> + Where do I add the custom java... (3)
-> + Where is the Diagram tab? (5)
-> + Applying XSLT to Word DOCX/XML (2)
-> - CSV conversion via ConvertToXM... (1)
-> + Text symbols in SS not same as... (4)
-> + Exposing xquery as webservice ... (6)
-> + Syntax Identifier (2)
-> + Saving a Converted XML as an X... (5)
-> + Output document cannot be pars... (4)
-> - Archiving output from conversi... (1)
-> + EDIFACT guideline from Stylus ... (3)
-> + CSV file putting all the data ... (5)
-> + Can't install Home version 64b... (5)
-> + presale - Can I covers this sc... (5)
-> + Problem with UNB (5)
-> + Splitting EDIFACT files pipeli... (4)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
chris dSubject: xslt issue
Author: chris d
Date: 12 Sep 2005 06:34 AM
hi

i'm using this stylesheet


<?xml version='1.0' encoding='us-ascii' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<identities>
<users>
<user>
<xsl:attribute name="firstname">
<xsl:value-of select="users/user/firstname"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="users/user/@id"/>
</xsl:attribute>
<xsl:attribute name="lastname">
<xsl:value-of select="users/user/lastname"/>
<level>
<xsl:attribute name="name">
<xsl:value-of select="users/user/level_x0020_name"/>
</xsl:attribute>
</level>
<xsl:for-each select="users/user">
<age>
<xsl:attribute name="range">
<xsl:value-of select="age_x0020_range"/>
</xsl:attribute>
</age>
</xsl:for-each>
</user>
</users>
</identities>

</xsl:template>
</xsl:stylesheet>

and what i want it each element /attribute to appear as in the following example file

<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE identities SYSTEM "identifiertransfer-v101.dtd">
<identities version="001" editdate="20050727" customer-id="Magna" completedata="TRUE">
<users>
<user id="94101" firstname="Serge" lastname="Buchner" ><level name="UPP"/><age range="AUT"/></user>

<user id="94102" firstname="Igor" lastname="Smart" ><level name="UPP"/><age range="AUT"/></user>

</users>


</identities>

but it is only displaying one full record and not each of them within the <user> tag. how do i achieve this ?

cheers

chris

Postnext
Tony LavinioSubject: xslt issue
Author: Tony Lavinio
Date: 12 Sep 2005 09:52 AM
You've only wrapped the age within the xsl:for-each, so that's
the only part that's getting executed in the loop.

Try moving the xsl:for-each to between the <users> and <user> line,
and the /xsl:for-each between <user> and <users>.

If that doesn't help, please post your source XML document, so we
can see what the incoming data looks like.

And to post, instead of putting the files in-line, there is a little
checkbox above the reply called "Attach File" which makes extracting
the files to look at simpler.

Postnext
chris dSubject: xslt issue
Author: chris d
Date: 15 Sep 2005 10:54 AM
thanks i worked it out in terms of elements and attributes but i want the converted xml document to contain the doctype declaration at the top of the document - i thought that CDATA would do the trick as below but it doesn't


code:
--------------------------------------------------------------------------------

<![CDATA[ <!DOCTYPE mecidentities SYSTEM "identifiertransfer-v101.dtd"> ]]>

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



is there something wrong with the cdata ? can i use this for the document type delcaration ?

I also want specify the chracter set in the converted document - would i use the same as above or an xslt function ?

cheers

chris

Postnext
(Deleted User) Subject: xslt issue
Author: (Deleted User)
Date: 15 Sep 2005 03:08 PM
Hi Chris,
in order to generate a DOCTYPE declaration in the output, you need to write

<xsl:output method="xml" doctype-system="identifiertransfer-v101.dtd"/>


Hope this helps,
Alberto

Postnext
chris dSubject: xslt issue
Author: chris d
Date: 16 Sep 2005 05:13 AM
ta

Posttop
Tony LavinioSubject: xslt issue
Author: Tony Lavinio
Date: 16 Sep 2005 02:30 PM
... and you can also set the encoding for the output document in
the xsl:output encoding= attribute.

   
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.