Joe,

Thank you for the reply, your response got me to test a
different path.

What I am trying to do is write an extension element that will
resolve an XPath statement to a block of XML that will be used
to build a different document other than the Result Tree.

What I did different was try my code as a straight forward XSL
example to see how the standard output formatter would perform.
So if you look at the XML and Style sheet below, I am trying
to emit the parameter using the <xsl:copy-of> which seems to
work, except for the strange handling of the comments.

Does the whitespace appear in the output as a result of the
<xsl:output tag or is the original whitespace in the parameter
maintained ??

Do you have any example code or point me to someplace in the Xalan
codebase that I can use as an example in my Extension Element. What
I want to do is process the Node/RTF (i.e. the result of evaluating
an expression) so that it will produce a new Node/RTF that is
formatted to include whitespace nodes ??

Thanks
John G


-------------------- Begin Style.xml ----------------------------- <?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:xalan="http://xml.apache.org/xslt";
 extension-element-prefixes="xalan"
 exclude-result-prefixes="xalan">

<xsl:output method="xml" indent="yes" xalan:indent-amount="4" />

<xsl:param name="newEntry">
 <!-- Comment -->
 <xsl:comment>XSL Comment</xsl:comment>
 <item name="KEY">
  <Name>New Name</FirstName>
  <Address>
   <City>CITY</City>
  </Address>
 </item>
</xsl:param>


<xsl:template match="/" > <root> <data><xsl:copy-of select="/data/item[1]" /></data> <param><xsl:copy-of select="xalan:nodeset($newEntry)" /></param> </root> </xsl:template>

</xsl:stylesheet>
-------------------- End Style.xml -----------------------------

-------------------- Begin DATA.XML -----------------------------
<data>
  <item name="My Entry">
    <FirstName>My Name</FirstName>
    <Address>
      <City>My City</City>
     </Address>
   </item>
</data>
-------------------- End DATA.XML -----------------------------


Joseph Kesselman wrote:





Whitespace-only text in most stylesheet elements is not meaningful, by design, and is discarded. Standard workarounds: make it something other than whitespace-only, or enclose it in xsl:text, or play games with xml:space (though that last sometimes has distinctly unexpected and unpleasant interactions with xsl:attribute, so I don't generally recommend it).

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


--
--------------------------------------
John Gentilin
Eye Catching Solutions Inc.
18314 Carlwyn Drive
Castro Valley CA 94546

    Contact Info
[EMAIL PROTECTED]
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917




Reply via email to