|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Newline problems
> 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








