[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Transform some attributes into HTML span elements with delimiters (specific format)
Subject: Re: [xsl] Transform some attributes into HTML span elements with delimiters (specific format) From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> Date: Thu, 27 May 2010 14:26:59 +0530 |
I think, I would have done this as following: <xsl:template match="InspectionReportInput"> <span id="firstName"><xsl:value-of select="@firstName" /></span> <span id="lastName"><xsl:value-of select="@lastName" /><xs:text>, </xsl:text><xsl:value-of select="@city" /> </xsl:template> and have invoked this template as following: <xsl:apply-template select="InspectionReportInput" /> On Thu, May 27, 2010 at 12:58 PM, Philipp Kursawe <phil.kursawe@xxxxxxxxx> wrote: > Hello, > > I have this XML > > <InspectionReportInput > B city="Some" > B firstName="Jon" > B lastName="Doe > B ... > B > > </InspectionReportInput> > > and would like to get this (partial) HTML output: > <span id="firstName">Jon</span> <span id="lastName">Doe</span>, <span > id="city">Some</span> > > So I want to put a space delimited between firstName and lastName and > after lastName a ",". > Currently my XSLT looks like this: > > <xsl:call-template name="span"><xsl:with-param name="id" > select="//@firstName"></xsl:with-param></xsl:call-template> > B B B <xsl:call-template name="span"><xsl:with-param name="id" > select="//@lastName"></xsl:with-param></xsl:call-template>, > B B B <xsl:call-template name="span"><xsl:with-param name="id" > select="//@city"></xsl:with-param></xsl:call-template> > > <xsl:template name="span" match="attribute::node()"> > B B <xsl:param name="id"></xsl:param> > B B <xsl:element name="span"><xsl:attribute name="id"><xsl:value-of > select="name($id)"/></xsl:attribute><xsl:value-of > select="$id"/></xsl:element> > B </xsl:template> > > As you can see its very verbose. I would like to have it a little less > verbose if possible. Something like this: > spans for the following "//@firstname //@lastName, //@city" > So I already give the charachters that should be emitted after the > template "span" is called. > > Thanks! > Phil -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Transform some attributes, Philipp Kursawe | Thread | Re: [xsl] Transform some attributes, Florent Georges |
Re: [xsl] Transform some attributes, Philipp Kursawe | Date | Re: [xsl] Transform some attributes, Florent Georges |
Month |