473,799 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stumped on this XSLT

PBR
Hi,

I'm trying to do some grouping on a set elements based on one of the set's
child element values. That seems to work OK. My problem is that I would like
to allow for additional child elements to be added to the source document
and have the XSLT copy them over without explicitly adding them to the XSL
file. My problem is that when I run the transformation in XmlSpy, I just get
back the text of all the nodes, and not the xml tags plus text. If I remove
the namespace from the root element of the source file, then it works as
expected. What do I need to do to the XSLT to make this work and still keep
the namespace in the source file? Samples are below.

Thanks,

P

<Details xmlns="http://someuri">
<Detail>
<EXPORTED>F</EXPORTED>
<EXPOR_DATE/>
<IMPORTED>F</IMPORTED>
<IMPOR_DATE/>
<TRNSXN>30185 </TRNSXN>
<REVISION>0</REVISION>
<ESTIM_DATE>200 40916</ESTIM_DATE>
<UNIT_ID_A>TEXU </UNIT_ID_A>
<UNIT_ID_N>2555 32</UNIT_ID_N>
</Detail>
<Detail>
<EXPORTED>F</EXPORTED>
<EXPOR_DATE/>
<IMPORTED>F</IMPORTED>
<IMPOR_DATE/>
<TRNSXN>30189 </TRNSXN>
<REVISION>0</REVISION>
<ESTIM_DATE>200 40916</ESTIM_DATE>
<UNIT_ID_A>TEXU </UNIT_ID_A>
<UNIT_ID_N>2555 32</UNIT_ID_N>
</Detail>
<Detail>
<EXPORTED>F</EXPORTED>
<EXPOR_DATE/>
<IMPORTED>F</IMPORTED>
<IMPOR_DATE/>
<TRNSXN>30185 </TRNSXN>
<REVISION>0</REVISION>
<ESTIM_DATE>200 40916</ESTIM_DATE>
<UNIT_ID_A>TEXU </UNIT_ID_A>
<UNIT_ID_N>2555 32</UNIT_ID_N>
</Detail>
<Detail>
<EXPORTED>F</EXPORTED>
<EXPOR_DATE/>
<IMPORTED>F</IMPORTED>
<IMPOR_DATE/>
<TRNSXN>30189 </TRNSXN>
<REVISION>0</REVISION>
<ESTIM_DATE>200 40916</ESTIM_DATE>
<UNIT_ID_A>TEXU </UNIT_ID_A>
<UNIT_ID_N>2555 38</UNIT_ID_N>
</Detail>
</Details>

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="DetailsBy UNIT_ID_N" match="Detail" use="UNIT_ID_N"/>
<xsl:template match="Details" >
<GroupedContain ers>
<xsl:for-each select="Detail[count(. | key('DetailsByU NIT_ID_N',
UNIT_ID_N)[1]) = 1]">
<xsl:sort select="UNIT_ID _N"/>
<xsl:element name="Container Group">
<xsl:attribut e name="UNIT_ID_N ">
<xsl:value-of select="UNIT_ID _N"/>
</xsl:attribute>
<xsl:for-each select="key('De tailsByUNIT_ID_ N', UNIT_ID_N)">
<xsl:element name="Container ">
<xsl:copy-of select="*" />
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</GroupedContaine rs>
</xsl:template>
</xsl:stylesheet>
Jul 20 '05 #1
1 1469


<xsl:template match="Details" >

That matches an element with local name Details and no namepace uri,
which doesn't match your source, change to
<xsl:template match="x:Detail s" xmlns:x="http://someuri">

then it will match.
<xsl:element name="Container Group">
<xsl:attribut e name="UNIT_ID_N ">
<xsl:value-of select="UNIT_ID _N"/>
</xsl:attribute>
...
</xsl:element>

It would be simpler to write that as

<ContainerGro up UNIT_ID_N="{UNI T_ID_N}">
...
</ContainerGroup>

David
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2886
by: awilliam | last post by:
I'm using the BIE workflow engine and after querying an LDAP DSA I need to transform the XML response, which looks like - <?xml version="1.0" encoding="UTF-8" ?> <batchResponse xmlns="urn:oasis:names:tc:DSML:2:0:core" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <searchResponse requestID="9"> <searchResultEntry dn="cn=Larry Simmons,ou=People,o=Morrison Industries,c=US"...
5
7643
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating business components that can be consumed by WebForms, WinForms, mobile devices, etc? Is it even fair to compare the such technologies? - How about for cases when you need to display dynamic elements on the form/grid (as compared to knowing data elements...
4
5252
by: Stephen | last post by:
I have the following that outputs an xml file to a div using ajax: <script type="text/javascript"> function ajaxXML(url,control_id){ if (document.getElementById) { var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); } if (x) {
5
4416
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT) and PDF (via XSL:FO). The only tool we have seen is Altova's StyleVision, which is very unfriendly (and uses a proprietary representation, SPS, from which it generates the various XSLs). We have considered instead using InfoPath, which is WYSIWYG,...
2
3229
by: Keith Chadwick | last post by:
I have been running some tests with regards to xsl:include and xsl:import with the same results on both and I am wondering if someone can explain this behavior to me! First off the xslt file is being loaded as in dim myXSLT as new XslTransform() myXSLT.load("scripts/clnt.home.body.xslt") The load craps out when I change the xsl:include, tried all of the following
10
2041
by: daz_oldham | last post by:
Hi I am doing an XSLT that processes (for example) a list of hotels. Each hotel has the attribute @StarRating which is one of the following values: * ** *** ****
1
2745
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time consuming. I keep getting the following error when I submit my email to their site. System.Xml.Xsl.XslTransformException: Cannot find the script or external object that implements prefix 'ext:MailingList'. at...
4
1471
by: J | last post by:
I've spent most of the day on this, and I just can't seem to find a solution, please help me! :) I'm recieving XML that I can't modify that looks like: <?xml version="1.0"?> <Doc> <Page> <Item Value="A" Id="1" Count="1"/> <Item Value="B" Id="2" Count="1"/>
3
1688
by: RC | last post by:
Let's say: if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { // Now I got an XML object here var xmlDocument = XMLHttpRequestObject.responseXML; // next I have dealing with XML file tags used DOM. var options = xmlDocument.getElementsByTagNameNS(null,"myXMLTag"); doMyFunctionWithHTMLDOM(options);
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.