[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Setting name attribute of
RE: [xsl] Setting name attribute of
Subject: RE: [xsl] Setting name attribute of <xsl:attribute> From: "Witham, Darren (Contractor)" <withd2@xxxxxx> Date: Fri, 10 Oct 2003 08:09:27 -0500 |
Hi Jeff, A cut down source doc is as follows, I have many many attributes on the parcel element but you should get the idea : <ShipmentParcelEvent> <Parcel action="update" Parcel_Sequence_Number="1" Disposal_Receipt_Indicator_RDCOD_FK="10100" Parcel_Type="PURCHASE" </Parcel> </ShipmentParcelEvent> The cut down xsl is as follows : <xsl:template match="/ShipmentParcelEvent"> <xsl:element name="ShipmentParcelEvent"> <xsl:element name="Parcel"> <xsl:call-template name="checkAttributeNotNull"> <xsl:with-param name="attributeName" select="Parcel_Sequence_number"/> <xsl:with-param name="attributeValue" select="./Parcel/@Parcel_Sequence_Number"/> </xsl:call-template> etc etc etc </xsl:element> </xsl:element> </xsl:template> Hope this is enough info........ Thx Darren -----Original Message----- From: Jeff Beadle [mailto:Jbeadle@xxxxxxxx] Sent: 10 October 2003 13:29 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Setting name attribute of <xsl:attribute> Hey Darren, Please submit the relevant portion of your source document. Also, where are the select attributes pulling from for the xsl:with-param elements in the xsl:call-template? Are they elements within the context of the given call? -Jeff -----Original Message----- From: Witham, Darren (Contractor) [mailto:withd2@xxxxxx] Sent: Friday, October 10, 2003 7:50 AM To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Setting name attribute of <xsl:attribute> Hi, I have what I hope is an easy issue to solve but my varying attempts to do so have not been successful. I have an xsl stylesheet which transforms some xml into another xml format. I only wish to generate XML in the output xml file if attributes in the src xml exist. At present I have a number of <xsl:if test......> directives to check if an attribute is present before processing. I would like to remove the need for the <xsl:if test......> and want to call a template to do the check and process if need be..... My template is <!-- Helper template that only pushes out out XML if value of attribute to publish is not null --> <xsl:template name="checkAttributeNotNull"> <xsl:param name="attributeName"/> <xsl:param name="attributeValue"/> <xsl:if test="$attributeValue"> <xsl:attribute name="{$attributeName}"> <xsl:value-of select="$attributeValue" /> </xsl:attribute> </xsl:if> </xsl:template> And I call if via : <xsl:call-template name="checkAttributeNotNull"> <xsl:with-param name="attributeName" select="anAttName"/> <xsl:with-param name="attributeValue" select="anAttValue"/> </xsl:call-template> The problem I have is within the template I call. I cannot seem to set the name of the attribute I am trying to create with the parameter 'attributeName'. ( i.e with <xsl:attribute name="{$attributeName}">) I have tried all sorts of combinations except for the correct one. I thought I could set this value at runtime ????? Any pointers appreciated. Thx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Setting name attribute of, Jeff Beadle | Thread | RE: [xsl] Setting name attribute of, Michael Kay |
[xsl] keep 2nd chapter element, Jim_Albright | Date | [xsl] xalan <xsl:element name="name, David . Pawson |
Month |