Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
Help to tune up this XSLT
Conferences
Stylus Studio Feature Requests
(1192)
Stylus Studio Technical Forum
(14621)
Website Feedback
(249)
XSLT Help and Discussion
(7625)
xslt params uknown number of i...
(2)
How to use fonts other than ba...
(2)
Converting existing HTML into ...
(1)
Help to tune up this XSLT
(2)
Help to tune up this XSLT
XSLT - is only converting the ...
(2)
XSLT Editor tab
(4)
Convert multiple files from XM...
(2)
how to use in select expressi...
(2)
Help needed in XSL transformat...
(2)
How to add a string with math ...
(5)
How to add a string with math ...
(6)
br element
(1)
Stylesheet directed terminatio...
(2)
Who can help me whit sum funct...
(2)
XSLT Works in Stylus Studio, n...
(3)
Filter by Attribute
(1)
Display x number of items whic...
(6)
MultiColumn Reporting
(3)
cant get namespace declaration...
(3)
Performance xsl:for each and n...
(3)
Previous
[361-380]
[381-400]
[401-420]
Next
XQuery Help and Discussion
(2017)
Stylus Studio FAQs
(159)
Stylus Studio Code Samples & Utilities
(364)
Stylus Studio Announcements
(113)
Topic
next
Subject:
Help to tune up this XSLT
Author:
Doug Lundin
Date:
18 Apr 2009 12:10 PM
Hi,
I've got an XML dataset like this:
<?xml version="1.0"?>
<env:Envelope xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns3:getMocksByFilterResponse xmlns="java:mocksvc.value" xmlns:ns3="mocksvc">
<ns3:arrayOfMock_result>
<Mock xsi:type="Corridor" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<name>Name1</name>
</Mock>
<Mock xsi:type="Corridor" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<name>Name2</name>
</Mock>
<Mock xsi:type="Circle" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<name>Name3</name>
</Mock>
</ns3:arrayOfMock_result>
</ns3:getMocksByFilterResponse>
</env:Body>
</env:Envelope>
And am using this XSLT:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:a="java:mocksvc.value">
<xsl:output method="xml" indent="no"/>
<xsl:template match="a:Mock">
<xsl:element name="Name">
<xsl:value-of select="a:name" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Which is returning:
<?xml version='1.0' ?>
<Name xmlns:a="java:mocksvc.value">Name1</Name>
<Name>Name2</Name>
<Name>Name3</Name>
What I really want to see is this:
<?xml version='1.0' ?>
<Highest>
<Name>Name1</Name>
<Name>Name2</Name>
<Name>Name3</Name>
</Highest>
This should be easy to do but I haven't been able to figure it out. Anyone have a solution?
Thanks!
Doug
top
Subject:
Help to tune up this XSLT
Author:
John Bampton
Date:
19 Apr 2009 11:29 AM
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:a="java:mocksvc.value" xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<Highest>
<xsl:apply-templates select="/env:Envelope/env:Body/*[namespace-uri()='mocksvc' and local-name()='getMocksByFilterResponse']/*[namespace-uri()='mocksvc' and local-name()='arrayOfMock_result']/*[namespace-uri()='java:mocksvc.value' and local-name()='Mock']"></xsl:apply-templates>
</Highest>
</xsl:template>
<xsl:template match="a:Mock">
<xsl:element name="Name">
<xsl:value-of select="a:name" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Cheers, John Bampton.
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 to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
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.