|
[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: XSLT that does uppercase translation of all attributes and
- From: "Michael Kay" <mike@s...>
- To: "'Minas Casiou'" <casi1min@p...>,<xml-dev@l...>
- Date: Tue, 5 Dec 2006 23:29:47 -0000
After xsl:element, use <xsl:copy-of
select="namespace::*"> to copy all the namespace declarations from the source
document to the result.
Hi all, I've got an XSLT that attempts to translate all attribute
and element values to UPPERCASE (using XSLT 1.0 at the moment).
Unfortunately my current solution is leaving
out the namespace prefix declarations out ... Any ideas anyone?
Sample Request
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:esb="urn:au.gov.nsw.police.xml.esb.common.version_1_0_0" xmlns:inc="urn:au.gov.nsw.police.xml.model.incident.incidentModel.version_1_0_0" xmlns:as4590="urn:au.gov.nsw.justiceSector.cim.as4590"> <SOAP-ENV:Body> <svc:WriteOffIncidentRq
xmlns:svc="urn:au.gov.nsw.police.xml.service.incident.incidentService.version_1_0_0">
<esb:Header>
<esb:ReplyTo>
<esb:AddressURL>String</esb:AddressURL>
<esb:Type>WebService</esb:Type>
</esb:ReplyTo>
<esb:Sender>
<esb:MessageID>String</esb:MessageID>
<esb:CorrelationID>CorrID123</esb:CorrelationID>
</esb:Sender>
<esb:Credentials>
<esb:UserID>406594</esb:UserID>
<esb:Role>String</esb:Role>
</esb:Credentials>
</esb:Header>
<inc:Incident>
<inc:RequestingIPAddress>20.15.26.152</inc:RequestingIPAddress> </inc:Incident> </svc:WriteOffIncidentRq>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
XSLT to convert to
uppercase <?xml version="1.0"
encoding="UTF-8"?> <xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="identity.xslt"/> <xsl:output
method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="*" > <xsl:element name="{local-name()}"
namespace="{namespace-uri()}">
<xsl:for-each select="../@*">
<xsl:attribute name="{name()}" >
<xsl:value-of
select="translate(. ,
$vLowercaseChars_CONST , $vUppercaseChars_CONST)"/>
</xsl:attribute> </xsl:for-each> <xsl:apply-templates select="node()|@*"/> </xsl:element> </xsl:template>
<xsl:template match="text()"
>
<xsl:value-of select="translate(. , $vLowercaseChars_CONST ,
$vUppercaseChars_CONST)"/> </xsl:template>
<xsl:variable name="vLowercaseChars_CONST" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="vUppercaseChars_CONST" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
</xsl:stylesheet>
Sample
Response <?xml version="1.0"
encoding="UTF-8"?> <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Body>
<WriteOffIncidentRq
xmlns="urn:au.gov.nsw.police.xml.service.incident.incidentService.version_1_0_0">
<Header xmlns="urn:au.gov.nsw.police.xml.esb.common.version_1_0_0">
<ReplyTo>
<AddressURL>STRING</AddressURL>
<Type>WEBSERVICE</Type>
</ReplyTo>
<Sender>
<MessageID>STRING</MessageID>
<CorrelationID>CORRID123</CorrelationID>
</Sender>
<Credentials>
<UserID>406594</UserID>
<Role>STRING</Role>
</Credentials>
</Header>
<Incident xmlns="urn:au.gov.nsw.police.xml.model.incident.incidentModel.version_1_0_0">
<RequestingIPAddress>20.15.26.152</RequestingIPAddress>
</Incident>
</WriteOffIncidentRq> </Body> </Envelope> Note that the:
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:esb="urn:au.gov.nsw.police.xml.esb.common.version_1_0_0" xmlns:inc="urn:au.gov.nsw.police.xml.model.incident.incidentModel.version_1_0_0" xmlns:as4590="urn:au.gov.nsw.justiceSector.cim.as4590">
namespace prefix
declarations are all missing...
Any
ideas anyone?
Thanks
Cheers Minas Casiou
| ESB Technical
Architect I&I | MRP - Mainframe Replacement
Program | BTS
| New South Wales Police
Phone: 02 9689 7610 | Eaglenet: 79610 | Mobile: 0431 103
925 | email: casi1min@p...
This message and any attachment
is confidential and may be privileged or otherwise protected from
disclosure. If you have received it by mistake, please let us know by
reply and then delete it from your system; you should not copy
the message or disclose its contents to
anyone.
|

[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
 |
| Atom 0.3 |
 |
| |
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|