Subject: RE: [xsl] Newline problems From: "Vishwajit Pantvaidya" <pantvaidya@xxxxxxxxxxx> Date: Tue, 06 May 2003 17:27:29 -0700 |
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: "'Vishwajit Pantvaidya'" <pantvaidya@xxxxxxxxxxx>, <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] Newline problems
Date: Tue, 6 May 2003 16:52:27 -0500
> I added these changes, resultant xsl sheet is as: > > <?xml version = "1.0" encoding = "UTF-8"?> > <xsl:transform xmlns:xsl = > "http://www.w3.org/1999/XSL/Transform" version = > "1.0"> > <xsl:template match = "Quote"> > <xsl:text disable-output-escaping="yes"><!DOCTYPE > Order></xsl:text> > <xsl:element name = "Order"> > <xsl:element name ="Info"> > <xsl:apply-templates mode = "Attribs" > select = "/Quote/Info/attribute"/> > </xsl:element> > </xsl:element> > </xsl:template>
> <xsl:template mode = "Attribs" match = "attribute"> > <xsl:call-template name="atomicValue"> > <xsl:with-param name="AVname" select="'BILL_TO_ADDRESS2'" /> > </xsl:call-template> > <xsl:call-template name="atomicValue"> > <xsl:with-param name="AVname" select="'PO_NUMBER'" /> > </xsl:call-template> > </xsl:template>
> <xsl:template name="atomicValue"> > <xsl:param name="AVname" select="''" /> > <xsl:element name="{$AVname}"> > <xsl:value-of > select="attribute/atomicValue[normalize-space(../name)=$AVname]"/> > </xsl:element> > </xsl:template> > </xsl:transform> > > > Output I get is as: > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE > Order><Order><Info><BILL_TO_ADDRESS2/><PO_NUMBER/><BILL_TO_ADDRESS2/> > <PO_NUMBER/><BILL_TO_ADDRESS2/><PO_NUMBER/></Info></Order>
OK, as David Carlisle pointed out, in the second template the context
node is an <attribute>, and we're trying to select its <attribute> children.
Oops.
So make your first apply-templates select "Info" instead of
"/Quote/Info/attribute", and change the second template's match
to match="Info".
Now it should work...
Lars
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Newline problems, Lars Huttar | Thread | Re: [xsl] Newline problems, Vishwajit Pantvaidya |
RE: [xsl] New element proposed for , Julian Reschke | Date | [xsl] Word 2003 beta XML, Jim_Albright |
Month |