Subject: [xsl] Urgent:Concat values of two eleemnt Nodes From: Kim <kimba_40@xxxxxxxxx> Date: Tue, 30 Oct 2001 15:14:33 -0800 |
Hi, I'm pretty new to the XML/XSL area. I have an input looks like this: <?xml version="1.0" encoding="UTF-8"?> <?xml stylesheet type="text/xsl" href="MeasDataCollection.xsl" ?> <?DOCTYPE MeasDataCollection SYSTEM "MeasDataCollection.dtd"> <mdc xmlns:HTML="http://www.w3.org/TR/REC-xml"> <mfh> <ffv>1</ffv> <cbt>20010725191502</cbt> </mfh> <md> <neid> </neid> <mi> <mst>20010725191502</mst> <gp>900</gp> <mt>networkInd</mt> <mt>signallingPointCode</mt> <mt>testPatternSltm</mt> <mv> <moid>ManagedElement=1,TransportNetwork=1,Mtp3bSp=MeenaMO</moid> <r>1</r> <r>777</r> <r>A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5</r> </mv> </mi> </md> <md> <neid> </neid> <mi> <mst>20010725191502</mst> <gp>900</gp> <mt>networkInd</mt> <mt>signallingPointCode</mt> <mt>testPatternSltm</mt> <mv> <moid>ManagedElement=1,TransportNetwork=1,Mtp3bSp=MeenaMO</moid> <r>1</r> <r>777</r> <r>A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5</r> </mv> </mi> </md> <md> <neid> </neid> <mi> <mst>20010725191502</mst> <gp>900</gp> <mt>pm_1</mt> <mt>pm_2</mt> <mt>pm_3</mt> <mv> <moid>ManagedElement=1,Test=1</moid> <r>10</r> <r>20</r> <r>30</r> </mv> </mi> </md> <md> <neid> </neid> <mi> <mst>20010725191502</mst> <gp>900</gp> <mt>pm_1</mt> <mt>pm_2</mt> <mt>pm_3</mt> <mv> <moid>ManagedElement=1,Test=1</moid> <r>10</r> <r>20</r> <r>30</r> </mv> </mi> </md> <mff>20010725191548</mff> </mdc> I'm trying to trannsform the input to a text-formatted output. In the following xsl file, it seems that I'm not getting the tree right? How do I: 1. Get the value of the <mff> node element display in the output right after the value of <mst> or <cbt> node? Use the ../../ path? 2. concat the <r> value to <mt> value? Here is the xsl file; thanks! <?xml version="1.0"?> <!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Kim G. --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:preserve-space elements="	"/> <xsl:template match="mdc"> <xsl:apply-templates select="mfh"/> <xsl:apply-templates select="md"/> <xsl:apply-templates select="mff"/> </xsl:template> <!-- ============================================================================= --> <xsl:template match="mfh"> <xsl:apply-templates select="ffv"/> <xsl:apply-templates select="cbt"/> </xsl:template> <xsl:template match="ffv"> File Version : <xsl:text/> <xsl:value-of select="."/> </xsl:template> <xsl:template match="cbt"> Collection Begin Time : <xsl:text/> <xsl:value-of select="."/> 
====================================================================== </xsl:template> <!-- ============================================================================= --> <xsl:template match="md"> <xsl:apply-templates select="mi"/> </xsl:template> <xsl:template match="mi"> <xsl:apply-templates select="mt"/> <xsl:apply-templates select="mst"/> </xsl:template> <xsl:template match="mst"> End of Granularity Period : <xsl:text/> <xsl:value-of select="."/> 
====================================================================== </xsl:template> <!-- ============================================================================= --> <xsl:template match="mv"> <xsl:apply-templates select="moid"/> <xsl:apply-templates select="r"/> </xsl:template> <xsl:template match="moid"> MO Instance : <xsl:text/> <xsl:value-of select="."/> </xsl:template> <!-- r = attr vals --> <xsl:template match="r"> 			ATTR_VALUE[n]			:	<xsl:text/> <xsl:value-of select="."/> <xsl:if test="position()=last()">-
</xsl:if> </xsl:template> <!-- ============================================================================= --> <!-- mt = attr names --> <xsl:template match="mt">-			<xsl:text/> <xsl:value-of select="."/>	:	FIXME_PUT_IN_ATTR_VALUE[n] </xsl:template> <!-- ============================================================================= --> <xsl:template match="mff"> End of Overall Collection : <xsl:text/> <xsl:value-of select="."/> </xsl:template> <!-- ============================================================================= --> The current output looks like this: <?xml version="1.0" encoding="UTF-8"?> File Version : 1 Collection Begin Time : 20010725191502 MO Instance : ManagedElement=1,TransportNetwork=1,Mtp3bSp=MeenaMO FIXME KEEP THIS ATTR VAL : 1 FIXME KEEP THIS ATTR VAL : 777 FIXME KEEP THIS ATTR VAL : A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5networkInd : FIXME VALUE signallingPointCode : FIXME VALUE testPatternSltm : FIXME VALUE End of Granularity Period : 20010725191502 ====================================================================== MO Instance : ManagedElement=1,TransportNetwork=1,Mtp3bSp=MeenaMO FIXME KEEP THIS ATTR VAL : 1 FIXME KEEP THIS ATTR VAL : 777 FIXME KEEP THIS ATTR VAL : A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5networkInd : FIXME VALUE signallingPointCode : FIXME VALUE testPatternSltm : FIXME VALUE End of Granularity Period : 20010725191502 ====================================================================== ;;;;;[ snip] ;;;;;;;;; Log Filter Info : MO Instance : ManagedElement=1,Test=1 Attribute Count : FIXME COUNT VALUE Attribute Info : FIXME KEEP THIS ATTR VAL : 10 FIXME KEEP THIS ATTR VAL : 20 FIXME KEEP THIS ATTR VAL : 30pm_1 : FIXME VALUE pm_2 : FIXME VALUE pm_3 : FIXME VALUE End of Granularity Period : 20010725191502 ====================================================================== End of Overall Collection : 20010725191548 This is the output I would like to have: File Version : 1 Collection Begin Time: 20010725191502 Collection End Time : 20010725191548 MO Instance : ManagedElement=1,TransportNetwork=1,Mtp3bSp=MeenaMO networkInd: 1 signallingPointCode: 777 testPatternSltm: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 End of Granularity Period : 20010725191502 ====================================================================== MO Instance : ManagedElement=1,TransportNetwork=1,Mtp3bSp=MeenaMO networkInd:1 signallingPointCode: 777 testPatternSltm: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 End of Granularity Period : 20010725191502 ====================================================================== ;;;;;[ snip] ;;;;;;;;; MO Instance : ManagedElement=1,Test=1 30pm_1: 10 pm_2 : 20 pm_3: null End of Granularity Period : 20010725191502 ====================================================================== .... .... XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] I need tools XML/XSL/XSD for , Cristobal Galiano Fe | Thread | Re: [xsl] Urgent:Concat values of t, Jörg Heinicke |
[xsl] Comparison of nodes minus a c, mjyoungblut | Date | Re: [xsl] running java from xsl, mhkay |
Month |