Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Stumped on this XSLT

From: "PBR" <pbrinkleyrogers@------.-------.--->
To: NULL
Date: 10/4/2004 7:17:00 PM
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>20040916</ESTIM_DATE>
  <UNIT_ID_A>TEXU</UNIT_ID_A>
  <UNIT_ID_N>255532</UNIT_ID_N>
 </Detail>
 <Detail>
  <EXPORTED>F</EXPORTED>
  <EXPOR_DATE/>
  <IMPORTED>F</IMPORTED>
  <IMPOR_DATE/>
  <TRNSXN>30189</TRNSXN>
  <REVISION>0</REVISION>
  <ESTIM_DATE>20040916</ESTIM_DATE>
  <UNIT_ID_A>TEXU</UNIT_ID_A>
  <UNIT_ID_N>255532</UNIT_ID_N>
 </Detail>
 <Detail>
  <EXPORTED>F</EXPORTED>
  <EXPOR_DATE/>
  <IMPORTED>F</IMPORTED>
  <IMPOR_DATE/>
  <TRNSXN>30185</TRNSXN>
  <REVISION>0</REVISION>
  <ESTIM_DATE>20040916</ESTIM_DATE>
  <UNIT_ID_A>TEXU</UNIT_ID_A>
  <UNIT_ID_N>255532</UNIT_ID_N>
 </Detail>
 <Detail>
  <EXPORTED>F</EXPORTED>
  <EXPOR_DATE/>
  <IMPORTED>F</IMPORTED>
  <IMPOR_DATE/>
  <TRNSXN>30189</TRNSXN>
  <REVISION>0</REVISION>
  <ESTIM_DATE>20040916</ESTIM_DATE>
  <UNIT_ID_A>TEXU</UNIT_ID_A>
  <UNIT_ID_N>255538</UNIT_ID_N>
 </Detail>
</Details>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
 <xsl:key name="DetailsByUNIT_ID_N" match="Detail" use="UNIT_ID_N"/>
 <xsl:template match="Details">
 <GroupedContainers>
<xsl:for-each select="Detail[count(. | key('DetailsByUNIT_ID_N', 
UNIT_ID_N)[1]) = 1]">
   <xsl:sort select="UNIT_ID_N"/>
   <xsl:element name="ContainerGroup">
    <xsl:attribute name="UNIT_ID_N">
     <xsl:value-of select="UNIT_ID_N"/>
    </xsl:attribute>
    <xsl:for-each select="key('DetailsByUNIT_ID_N', UNIT_ID_N)">
      <xsl:element name="Container">
         <xsl:copy-of select="*" />
      </xsl:element>
    </xsl:for-each>
   </xsl:element>
  </xsl:for-each>
  </GroupedContainers>
 </xsl:template>
</xsl:stylesheet> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent