Altova Mailing List Archives


ResultTreeFrag to String

From: Honglin Su <hosu@------------->
To:
Date: 9/4/2000 9:07:00 AM
Hi, there,

When I use XSLT (XALAN 1.1) to process the XML with mixed elements, e.g.

 <?xml version="1.0" standalone="yes" ?> 
  <Lease>
  <Lessee>ABC Industries</Lessee> 
  agrees to lease the property at 
  <Address>123 Main St., Chicago, IL</Address> 
  from 
  <Lessor>XYZ Properties</Lessor> 
  for a term of not less than 
  <LeaseTerm TimeUnit="Months">18</LeaseTerm> 
  at a cost of 
  <Price Currency="USD" TimeUnit="Months">1000</Price> 
  . 
  </Lease>

If the node has a text child, I will get the sub-tree (String
representation) of the node, and pass it to a Java extenstion. 

<?xml version="1.0" ?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >

<xsl:template match="/">
  <xsl:apply-templates /> 
       Successful!!!!! 
</xsl:template>

<xsl:template match="*[text()]">
    <xsl:variable name="fulltext">
         <xsl:copy-of select="." /> 
    </xsl:variable>
    <xsl:copy-of select="$fulltext" /> 
</xsl:template>

</xsl:stylesheet>

Here the variable $fulltext has the type ResultTreeFrag, however, what I
want is only the String value like:
<Lease>
  <Lessee>ABC Industries</Lessee> 
  agrees to lease the property at 
  <Address>123 Main St., Chicago, IL</Address> 
  from 
  <Lessor>XYZ Properties</Lessor> 
  for a term of not less than 
  <LeaseTerm TimeUnit="Months">18</LeaseTerm> 
  at a cost of 
  <Price Currency="USD" TimeUnit="Months">1000</Price> 
  . 
  </Lease>

Is there any way to approach this?  Thanks!

Honglin


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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.