[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to work with the element which has multiple child text n

Subject: How to work with the element which has multiple child text nodes
From: Honglin Su <hosu@xxxxxxxxxxxxx>
Date: Mon, 17 Jul 2000 16:35:18 -0400 (EDT)
child text
Hi, there,

Suppose that I have a document-centric XML document, one element node
might have multiple child text nodes and other child nodes as well, and
the order is also important.

e.g.: lease.xml

<?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>

When I apply an XSL stylesheet to process the XML document, if such a node
is found (whenever a node has child text node), the whole sub-tree will
be passed to Java extension class to process.

  <?xml version="1.0" ?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0" xmlns:lxslt="http://xml.apache.org/xslt" 
xmlns:storexml="storeXML" extension-element-prefixes="storexml">
  <xsl:strip-space elements="*" />
  <lxslt:component prefix="storexml" functions="testInsert closeConn 
insertDB">
  <lxslt:script lang="javaclass" src="storeXML" />
  </lxslt:component>
  <xsl:template match="/">
  <xsl:apply-templates />
  <xsl:value-of select="storexml:closeConn()" />
  Successful!!!!!
  </xsl:template>
 <!--  process the children
  -->
 <xsl:template match="*">
  <xsl:value-of select="storexml:insertDB(.., ., text(), @*)" />
  <xsl:apply-templates />
  </xsl:template>
  <xsl:template match="text()" />
  </xsl:stylesheet>

Can anyone help me modify this stylesheet? What kind of parameter should
be passed on the extension class and how to keep the  whole sub-tree so
that I can do further processing.

Is there any way that after I pass the parameter to Java extension
class, I could get the String representation of the sub-tree from the
current node, e.g. 

<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>

Thank you very much!

Honglin



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.