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