RE: [xsl] Newline problems

Subject: RE: [xsl] Newline problems
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Fri, 2 May 2003 15:34:26 -0500
> Thanks for your reply, Lars.
> 
> Actually, my entire output xml is empty, meaning most element 
> tags exist 
> without any values in the output xml.

Hmm, so there is output, but it consists of empty elements.
I understand better now... that fits exactly with what you thought,
that the values of the text nodes in your input document
differ from what you expected by having newlines on them.

> Here is the source xml and the xsl in more detail:
> 
> <!DOCTYPE ABC [
> ...
> ]><ABC>
> ...
> <info>
> <attr>
> <name>
> ponumber</name>
> <atomicValue>
> 12345</atomicValue>
> </attr>
> ...
> </info>
> ...
> </ABC>
> 
> 
> 
> <?xml version = "1.0" encoding = "UTF-8"?>
> <xsl:transform xmlns:xsl = 
> "http://www.w3.org/1999/XSL/Transform"; version = 
> "1.0">
> <xsl:template match = "ABC">
> <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE 
> OrderProcessing&gt;</xsl:text>
> <xsl:element name = "Order">
> <xsl:element name ="Info">
> <xsl:apply-templates mode = "Attribs" select = "/ABC/info"/>
> </xsl:element>
> </xsl:element>
> </xsl:template>
> ...
> <xsl:template mode = "Attribs" match = "info">
> <xsl:element name = "PO_NUMBER">
> <xsl:value-of select="attr/atomicValue[../name='ponumber']"/>

Yes, it makes sense that this element would not have a value in the output,
because as you suspected, the contents of attr/name is not 'ponumber' but '
ponumber'.  This can be cured with
<xsl:value-of select="attr/atomicValue[normalize-space(../name)='ponumber']"/>


> </xsl:element>
> ...
> </xsl:template>
> ...
> </xsl:transform>
> 
> 
> About your query about xsl-output doctype-public, our source 
> xml has an 
> inline DTD. I understand that doctype-public or system are to 
> be used if we 
> have an external DTD. Is that correct?

Yes, for the *output* document.
Sounds like your output document has an inline DTD too, in which
case never mind.

Lars


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread