[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] FW: Using a processing instruction to remove a node
I have an XML document with a processing instruction that precedes a node that I'd like removed, but I'm having trouble with the XSL. Any help would be appreciated. Thanks. Here's an example of the XML document. <?xml version="1.0" encoding="UTF-8"?> <root> <node value="1"> <inner-node>1</inner-node> </node> <?REMOVE?> <node value="2"> <inner-node>2 - remove me</inner-node> </node> <node2 value="3"> <inner-node>3</inner-node> </node2> <node2 value="4"> <inner-node>4</inner-node> </node2> </root> This is the result I want. <?xml version="1.0" encoding="UTF-8"?> <root> <node value="1"> <inner-node>1</inner-node> </node> <node2 value="3"> <inner-node>3</inner-node> </node2> <node2 value="4"> <inner-node>4</inner-node> </node2> </root> Here's the XSL I have currently. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8"/> <xsl:template match="node()"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()[not(preceding-sibling::processing-instruction('REMOVE'))] "/> </xsl:copy> </xsl:template> <xsl:template match="processing-instruction('REMOVE')"> </xsl:template> </xsl:stylesheet> Here's the result that I'm getting. <?xml version="1.0" encoding="UTF-8"?> <root> <node value="1"> <inner-node>1</inner-node> </node> </root> CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. ---------------------------------------- -- 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
|