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
Topic
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next 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.
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
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.