[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

cross reference call of templates in xslt

Subject: cross reference call of templates in xslt
From: "Michael Richter" <A6Sr.CRD@xxxxxxx>
Date: Wed, 17 Dec 2008 20:29:48 +0100
 cross reference call of templates in xslt
Hi,
I have a XSL-Stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdo="http://www.xdomea.de">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" /> 
	
	<xsl:template match="/"> 
		<xsl:for-each select="/X">
			<X>
				<xsl:for-each select="/XDOMEA/Dokument">	
					<Dokument>
						<xsl:call-template name="dokument"/>
					</Dokument>
			</X>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="dokument">
		<Primaerdokument>
			<xsl:copy-of select="./Primaerdokument/Dateiname"/>
		</Primaerdokument>			
		<xsl:call-template name="AdressenInfo" />	
	</xsl:template>	

	<xsl:template name="AdressenInfo">
		<xsl:if test="./Adress_Informationen/Absender/Referenz">
			<xsl:apply-templates select="/XDOMEA/Adresse"><xsl:with-param name="referenceID" select="./Adress_Informationen/Absender/Referenz" /></xsl:apply-templates>
		</xsl:if>
	</xsl:template>

	<xsl:template name="adresse">
	  	<xsl:param name="referenceID" />
		    	<Name_ID><xsl:value-of select="./Name/Name_ID" /></Name_ID>
				<adr_name><xsl:value-of select="./Name/Nachname" /></adr_name>
				<adr_anrede><xsl:value-of select="./Name/Anrede" /></adr_anrede>
			</Adresse>
		</xsl:if>	
	</xsl:template>
</xsl:stylesheet>


My XML-File as Input:
<?xml version="1.0" encoding="UTF-8"?>
<X>
  <Daten>
    <Dokument>
      <Primaerdokument>
        <Dateiname>test.txt</Dateiname>
     </Primaerdokument>
      <Adress_Informationen>
        <Absender>
          <Referenz>d1139077-ed5b-4be8-9eaa-775ab4052c5c</Referenz>
        </Absender>
      </Adress_Informationen>
    </Dokument>
    <Adresse>
      <Name>
        <Name_ID>1234567890</Name_ID>
        <Anrede>a</Anrede>
      </Name>
      <Anschrift>
        <Strasse>i</Strasse>
      </Anschrift>
    </Adresse>
  </Daten>
</X>


Now my Result:
?xml version="1.0" encoding="UTF-8"?>
<X>
<Dokument>
<Primaerdokument>
<Dateiname>test (080011538) (080011547).txt</Dateiname>
</Primaerdokument>
 
        1234567890
        a
        i
 </Dokument>
 </XDOMEA>


So i need the information of the part of "Adresse" put into the part of "Primaerdokument".

I need the following result:
?xml version="1.0" encoding="UTF-8"?>
<X>
<Dokument>
<Primaerdokument>
<Dateiname>test (080011538) (080011547).txt</Dateiname>
</Primaerdokument>
<Name_ID>1234567890</Name_ID>
<adr_name>a</adr_name>
<adr_anrede>i</adr_anrede>
 </Dokument>
 </XDOMEA>


So: Is it possible to do with XSLT what i need? And what do i need to change in my XSLT-File? I'm doing the Transformatino in Java with javax.xml.transform.Transformer

Thanks and kind regards.


-- 
Sensationsangebot verldngert: GMX FreeDSL - Telefonanschluss + DSL 
f|r nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.