Need Help for Creating XSLT 2.0 for generating desired

XML Input :
		  <K p="New1">AIR Pollution</K>
		  <K p="New2">WATER Pollution</K>
		<Para_Ref L="Pollution">6.6</Para_Ref>
		<Para_Ref L="Pollution">22</Para_Ref>
		  <K p="New3">Marine pollution</K>
		  <K p="New4">Soil pollution</K>
		  <K>Noise pollution</K>
		<Para_Ref L="Pollution">22</Para_Ref>
		<Para_Ref L="Pollution">24</Para_Ref>
		  <K p="New5">Biological contamination</K>
		  <K p="New6">Light Pollution</K>
		  <K>Power Pollution</K>
		<Para_Ref L="Pollution">22</Para_Ref>
		  <K p="New7">Environmental Pollution</K>
		  <K p="New8">Land Pollution</K>
		  <K>chemical Pollution</K>
		<Para_Ref L="Pollution">6.6</Para_Ref>
		<Para_Ref L="Pollution">22</Para_Ref>
		<Para_Ref L="Pollution">24</Para_Ref>
		  <K>World Pollution</K>
		<Para_Ref L="Pollution">38</Para_Ref>

Open in new window

Desired Output:
<field TopicName>
       <div class="PollutionName">
			<p> AIR Pollution : WATER Pollution <PageNo>Page No.(6.6, 22) </PageNo></p>
			<p>Marine pollution : Soil pollution : Noise pollution <PageNo>Page No.(22, 24)</PageNo></p>
			<p>Biological contamination : Light Pollution : Power Pollution <PageNo>Page No.(22)</PageNo></p>
			<p>Environmental Pollution : Land Pollution : Chemical Pollution <PageNo>Page No.(6.6, 22, 24)</PageNo></p>
			<p>World Pollution<PageNo>Page No.(38)</PageNo></p>

Open in new window

Could anyone help us out with XSLT 2.0 Code for generating the xml output?

Any help is appreciated. Thanks in advance.
Mahesh SawarkarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
This seems like a typical grouping case, try this

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""
   <xsl:output indent="yes"></xsl:output>
    <xsl:template match="/Study_Topic">

    <xsl:template match="Topics">
            <div class="PollutionName">
                <xsl:for-each-group select="*" group-starting-with="PollutionName">
                        <xsl:value-of select="string-join(K, ' : ')"/>
                        <xsl:text> </xsl:text>
                            <xsl:text>Page No.(</xsl:text>
                            <xsl:value-of select="string-join(current-group()/self::Para_Ref, ', ')"/>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mahesh SawarkarAuthor Commented:
Thank You Geert Bormans.
Gertone (Geert Bormans)Information ArchitectCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.