Click here to Skip to main content

XML / XSL

    RSS: RSS Feed

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page  Show 
  Refresh
AnswerRe: Display a image in picturebox PinmvpStuart Dootson21:50 23 Feb '10  
GeneralRe: Display a image in picturebox [modified] Pinmemberkpuneeth722:01 23 Feb '10  
GeneralRe: Display a image in picturebox PinmvpStuart Dootson22:36 23 Feb '10  
GeneralRe: Display a image in picturebox Pinmemberkpuneeth70:53 24 Feb '10  
GeneralRe: Display a image in picturebox PinmvpStuart Dootson1:08 24 Feb '10  
GeneralRe: Display a image in picturebox Pinmemberkpuneeth72:26 24 Feb '10  
QuestionMultiple group using Muenchian Method [modified] PinmemberONeil Tomlinson5:15 23 Feb '10  
I have the following input XML. I want to group all unique Code/ID combination.
 
<List>
 <Section>
  	<Code>AA</Code>
  	<ID>11</ID>
 <Section>
 <Section>
  	<Code>AA</Code>
  	<ID>11</ID>
 <Section>
 <Section>
  	<Code>CC</Code>
  	<ID>11</ID>
 <Section>
 <Section>
  	<Code>AA</Code>
  	<ID>22</ID>
 <Section>
 <Section>
  	<Code>AA</Code>
  	<ID>11</ID>
 <Section>
<List>
 
So result should be as shown below.
 

<Code>AA</Code>
<ID>11</ID>
 
<Code>CC</Code>
<ID>11</ID>
 
<Code>AA</Code>
<ID>22</ID>
 
Im using the Muenchian Method. Currely my XSL (below) is grouping by Code (and not Code/ID combination)
 
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns0="http://A4C.Interface.HRP.Payroll.Schemas">
	<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
 
	<xsl:key name="CCids" match="/List/Section" use="Code"/>
 
	<xsl:template match="/">
		<xsl:apply-templates select="/ns0:Payroll" />
	</xsl:template>
	<xsl:template match="/ns0:Payroll">
		<ns0:List>
			<xsl:for-each select="/List/Section [generate-id(.)=generate-id(key('CCids',Code))]">
				<Section>
					<Code>
						<xsl:value-of select="code/text()" />
					</Code>
					<ID>
						<xsl:value-of select="id/text()" />
					</ID>
				</Section>
			</xsl:for-each>
		</ns0:List>
	</xsl:template>
</xsl:stylesheet>
 

How do i get this to use a Code/ID combination? I tried nested for-each loop but no luck. Thanks
modified on Tuesday, February 23, 2010 11:40 AM

AnswerRe: Multiple group using Muenchian Method PinmvpStuart Dootson21:47 23 Feb '10  
GeneralRe: Multiple group using Muenchian Method PinmemberONeil Tomlinson1:05 24 Feb '10  
QuestionHow Do I deserialize the following Xml string? [modified] Pinmemberashishtango0:05 23 Feb '10  
AnswerRe: How Do I deserialize the following Xml string? PinmvpStuart Dootson0:54 23 Feb '10  
GeneralRe: How Do I deserialize the following Xml string? Pinmemberashishtango17:52 23 Feb '10  
GeneralRe: How Do I deserialize the following Xml string? PinmvpStuart Dootson21:27 23 Feb '10  
GeneralRe: How Do I deserialize the following Xml string? Pinmemberashishtango19:35 24 Feb '10  
QuestionAccessing a image from a xml file and display in visual studio picture box Pinmemberkpuneeth722:15 22 Feb '10  
AnswerRe: Accessing a image from a xml file and display in visual studio picture box PinmvpRichard MacCutchan23:31 22 Feb '10  
Questionxsd to entity [modified] Pinmemberpokiri18:45 22 Feb '10  
AnswerRe: xsd to entity PinsupporterMark Nischalke22:01 22 Feb '10  
QuestionHow to delete duplicate nodes from XML throgh C#? Pinmemberdeadlyabbas20:12 18 Feb '10  
QuestionProblem with MSXML6 + namespace + XPath PinmemberPatrice.Espie5:57 18 Feb '10  
AnswerRe: Problem with MSXML6 + namespace + XPath PinmvpStuart Dootson1:10 23 Feb '10  
QuestionProblem with loading a xml to DataSet Pinmemberalireza_shokoie0:42 16 Feb '10  
AnswerRe: Problem with loading a xml to DataSet Pinmemberdaveyerwin3:51 18 Feb '10  
QuestionXSL help PinmemberMember 39976061:13 7 Feb '10  
AnswerRe: XSL help PinmvpStuart Dootson2:09 7 Feb '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.5.120210.1 | Last Updated 10 Feb 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid