Subject: Re: [xsl] Urgent:Concat values of two eleemnt Nodes From: Jörg Heinicke <joerg.heinicke@xxxxxx> Date: Wed, 31 Oct 2001 04:15:16 +0100 |
Hello Kim, 1. Who should understand this XML-file? ;-) Give a hint what 'mdc', 'mfh' and so on are. > 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. Yes, this is possible. Or /mdc/mff. If there are more than one in a file (I don't know whether ...), following::mff[1] (the first following mff in document order) will be more helpful I assume. But if there is only 1 /mdc/mff should be the fastest way. > 2. concat the <r> value to <mt> value? You want to create text, so you don't need to concat, write the 2 values in one row or however. <xsl:value-of select="r"/><xsl:value-of select="mt"/> the concat(): <xsl:value-of select="concat(r,mt)"/> > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="xml" indent="yes"/> When you want to create text, why you don't switch the output-method to text? <xsl:output method="text"/> > <xsl:preserve-space elements="	"/> What's that? With <xsl:preserve-space> you tell the elements written space-delimited in elements="...." to hold there spaces. I think you don't need it here. > <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> Why you use empty <xsl:text>-nodes? It's better to write the complete 'File Version :' and all text-nodes in a <xsl:text> I don't get your 'current output'. After formatting your XSL to the following I get this output: File Version : 1 Collection Begin Time : 20010725191502 ====================================================================== - networkInd : FIXME_PUT_IN_ATTR_VALUE[n] - signallingPointCode : FIXME_PUT_IN_ATTR_VALUE[n] - testPatternSltm : FIXME_PUT_IN_ATTR_VALUE[n] End of Granularity Period : 20010725191502 ====================================================================== - networkInd : FIXME_PUT_IN_ATTR_VALUE[n] - signallingPointCode : FIXME_PUT_IN_ATTR_VALUE[n] - testPatternSltm : FIXME_PUT_IN_ATTR_VALUE[n] End of Granularity Period : 20010725191502 ====================================================================== End of Overall Collection : 20010725191548 XSL: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <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"> <xsl:text>File Version : </xsl:text> <xsl:value-of select="."/> <xsl:text>
</xsl:text> </xsl:template> <xsl:template match="cbt"> <xsl:text>Collection Begin Time : </xsl:text> <xsl:value-of select="."/> <xsl:text>
============================================================= =========</xsl:text> <xsl:text>
</xsl:text> </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"> <xsl:text>End of Granularity Period : </xsl:text> <xsl:value-of select="."/> <xsl:text>
============================================================= =========</xsl:text> <xsl:text>
</xsl:text> </xsl:template> <xsl:template match="mv"> <xsl:apply-templates select="moid"/> <xsl:apply-templates select="r"/> </xsl:template> <xsl:template match="moid"> <xsl:text>MO Instance : </xsl:text> <xsl:value-of select="."/> <xsl:text>
</xsl:text> </xsl:template> <xsl:template match="r"> <xsl:text>			ATTR_VALUE[n]			:	</xsl:text> <xsl:value-of select="."/> <xsl:if test="position()=last()">-
</xsl:if> <xsl:text>
</xsl:text> </xsl:template> <xsl:template match="mt"> <xsl:text>-			</xsl:text> <xsl:value-of select="."/> <xsl:text>	:	FIXME_PUT_IN_ATTR_VALUE[n]</xsl:text> <xsl:text>
</xsl:text> </xsl:template> <xsl:template match="mff"> <xsl:text>End of Overall Collection : </xsl:text> <xsl:value-of select="."/> <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet> Try to tell us more exactly what you want. I'm sure we can help you. Joerg XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Urgent:Concat values of two e, Kim | Thread | [xsl] Netscape6.x not recognizing d, JYurow |
Re: [xsl] Comparison of nodes minus, Jörg Heinicke | Date | Re: [xsl] Xalan Encoding Problems -, Raul Rodriguez |
Month |