Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Need XSLT help to copy XML except given node

From: tim.reynolds@------.------
To: NULL
Date: 1/4/2007 10:56:00 AM

Andy,
One other variation hoping you can help me with.
I have an XML with a namespace declaration at the top:
xmlns="http://www.verizon.com/VOSE/ServiceOrders"

In this case, the identity template is not working  - without this xmlns def 
it works fine. I've tried several ways to modify the identity template to 
include this namespace, but have been unable.  Any ideas?
Thanks,
Tim

"Andy Bates" wrote:

> Tim -
> 
> Use an identity with an empty template for the node that you don't want to 
> copy:
> 
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 
> <!-- Identity transformation for the document. -->
> <xsl:template match="node()|@*">
>   <xsl:copy>
>     <xsl:apply-templates select="node()|@*"/>
>   </xsl:copy>
> </xsl:template>
> 
>  <!-- Don't do any processing when we find this node. -->
>  <xsl:template match="NON_PROVISIONABLE_WITHOUT_INSIDE_ACCESS"/>
> 
> </xsl:stylesheet>
> 
> The first template will copy everything. The second will be called for the 
> specific node you want to exclude. As it doesn't perform any calls (it's 
> just empty) it will remove the node and all of it's children.
> 
> The identify template above could also be revised to have a conditional 
> predicate which stopped it copying the node also but the above it probably 
> easier to understand.
> 
> HTH
> 
> - Andy
> 
> "Tim Reynolds" <tim.reynolds@o...> wrote in message 
> news:F1096AD3-BF5E-425B-9C80-ECEAFD42BED5@m......
> > Team,
> > New to XSLT. Need to be able to copy XML verbatim except a given node.  In
> > this example need to copy entire XML EXCEPT
> > NON_PROVISIONABLE_WITHOUT_INSIDE_ACCESS node and it's children:
> >
> > <?xml-stylesheet type="text/xsl" href="C:\Documents and
> > Settings\TReynolds\Desktop\CopyIt.xslt"?>
> > <AddOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:noNamespaceSchemaLocation="C:\My
> > Documents\VOSE\VIEWS\TReynolds_DecBugFix06\VOSE1\Common\VOSE.Common.DataElements\Schema\addorder.xsd">
> > <ORDER_HEADER>
> > <MASTER_ORDER_NUMBER>0S5796182</MASTER_ORDER_NUMBER>
> > <ORDER_NUMBER>5796182</ORDER_NUMBER>
> > <VERSION_NUMBER>002</VERSION_NUMBER>
> > <SUPP_TYPE>Pending</SUPP_TYPE>
> > <ORDER_TYPE>N</ORDER_TYPE>
> > <SYSTEM_REGION_ID>S</SYSTEM_REGION_ID>
> > <EAST_WEST_IND>W</EAST_WEST_IND>
> > <SERVICE_CLASS>RESIDENCE</SERVICE_CLASS>
> > <CUSTOMER_ACCOUNT_ID>2816087221</CUSTOMER_ACCOUNT_ID>
> > <ACCOUNT_TYPE>NRES</ACCOUNT_TYPE>
> > <BILLING_TN>1111111111</BILLING_TN>
> > <DUE_DATE>2007-01-09</DUE_DATE>
> > <DISPATCH_COEFFICIENT>2.0</DISPATCH_COEFFICIENT>
> > <APPOINTMENT_START_TIME>08:00</APPOINTMENT_START_TIME>
> > <APPOINTMENT_END_TIME>17:00</APPOINTMENT_END_TIME>
> > <APPOINTMENT_DATE>2007-01-09</APPOINTMENT_DATE>
> > <APPOINTMENT_APPROVED_BY_INDICATOR>C</APPOINTMENT_APPROVED_BY_INDICATOR>
> > <APPOINTMENT_APPROVED_BY>OCG</APPOINTMENT_APPROVED_BY>
> > <TIME_ZONE>CDT</TIME_ZONE>
> > <APPOINTMENT_SPECIAL_INSTRUCTION>TN 1111111111 LINEACTION I
> > AAISFZFSOLUTIONID511IVAPP ORDER NUMBER IS 001880372THE AWAS JOB ID
> > ISIncomplete Tech Update MessageIncomplete Tech Update MessageCBR = 123
> > 939-5870AWAS APPT 08:00A-17:00P 
> > 01-09-2007</APPOINTMENT_SPECIAL_INSTRUCTION>
> > <COORDINATION_TIME>00:00</COORDINATION_TIME>
> > <REMARKS>POWER RQMTS QUOTED TO TODD HATHCOCK 12/22/2006 
> > 0S5796182</REMARKS>
> > <REMARKS>CROSS STREETS: 407 AND GARDENRIDGE</REMARKS>
> > <REMARKS>called cust about appt for 12/31;left message on cust's
> > vms.</REMARKS>
> > <REMARKS>....Ksimpson/Verizon/call ahead</REMARKS>
> > <REMARKS>....KSIMPSON/VERIZON/CALL AHEAD</REMARKS>
> > <FIBER_RELATED_ORDER>ICOG043924296</FIBER_RELATED_ORDER>
> > <FIBER_RELATED_ORDER_DATA>ICOG043924296</FIBER_RELATED_ORDER_DATA>
> > <ORIGNATING_SYSTEM>NOCV</ORIGNATING_SYSTEM>
> > <CUSTOMER_CONTACT_NAME>TODD BOBBY</CUSTOMER_CONTACT_NAME>
> > <CUSTOMER_CONTACT_PHONE>1231231234</CUSTOMER_CONTACT_PHONE>
> > <CUSTOMER_NAME>TODD BOBBY</CUSTOMER_NAME>
> > <RESPONSIBILITY_CENTER>NT97</RESPONSIBILITY_CENTER>
> > <ORDER_CREATE_DATE>2006-12-22</ORDER_CREATE_DATE>
> > <ORDER_CREATE_TIME>16:21</ORDER_CREATE_TIME>
> > <ADDRESS_VALIDATION_BYPASS>N</ADDRESS_VALIDATION_BYPASS>
> > <VOICE_HEADER/>
> > <VOICE_DATA_VIDEO_TYPE>110</VOICE_DATA_VIDEO_TYPE>
> > <SUPP_VOICE_DATA_VIDEO_TYPE>110</SUPP_VOICE_DATA_VIDEO_TYPE>
> > <VOICE_DUE_DATE>2007-01-09</VOICE_DUE_DATE>
> > <DATA_DUE_DATE>2007-01-09</DATA_DUE_DATE>
> > <VOICE_DUE_DATE_OPTION>F</VOICE_DUE_DATE_OPTION>
> > <DATA_DUE_DATE_OPTION>F</DATA_DUE_DATE_OPTION>
> > <VIDEO_DUE_DATE_OPTION>C</VIDEO_DUE_DATE_OPTION>
> > </ORDER_HEADER>
> > <ADDRESS_GROUP>
> > <SERVICE_ADDRESS>
> > <HOUSE>1</HOUSE>
> > <STREET>MAIN ST</STREET>
> > <CITY>TAMPA</CITY>
> > <STATE>FL</STATE>
> > <ZIP>33610</ZIP>
> > </SERVICE_ADDRESS>
> > <ACO>B3L</ACO>
> > <WIRE_CENTER>SW7AAAA</WIRE_CENTER>
> > <VOICE_RECORDS>
> > <LINE_RECORD>
> > <ACTION_CODE>I</ACTION_CODE>
> > <TN>1231231234</TN>
> > <SERVICE_TYPE>74864</SERVICE_TYPE>
> > <FTTP_FLAG>Y</FTTP_FLAG>
> > <TN_OVERRIDE_BY_REP>N</TN_OVERRIDE_BY_REP>
> > </LINE_RECORD>
> > <FEATURE_RECORD_TYPE>
> > <NON_PROVISIONABLE_WITHOUT_INSIDE_ACCESS>
> > <iosc_element>48803</iosc_element>
> > <iosc_element>02543</iosc_element>
> > <iosc_element>02548</iosc_element>
> > <iosc_element>48800</iosc_element>
> > <iosc_element>11981</iosc_element>
> > <iosc_element>48809</iosc_element>
> > <iosc_element>36005</iosc_element>
> > <iosc_element>Z2771</iosc_element>
> > <iosc_element>20070</iosc_element>
> > <iosc_element>61663</iosc_element>
> > <iosc_element>87002</iosc_element>
> > <iosc_element>48810</iosc_element>
> > </NON_PROVISIONABLE_WITHOUT_INSIDE_ACCESS>
> > <FEATURE_ACTION_CODE>I</FEATURE_ACTION_CODE>
> > <ADDL_LINE_FLAG>Y</ADDL_LINE_FLAG>
> > <TC>Y</TC>
> > <IOSC_PARAMETER_LIST>
> > <IOSC_FIELD_NAME>74864</IOSC_FIELD_NAME>
> > </IOSC_PARAMETER_LIST>
> > <IOSC_PARAMETER_LIST>
> > <IOSC_FIELD_NAME>04778</IOSC_FIELD_NAME>
> > </IOSC_PARAMETER_LIST>
> > <IOSC_PARAMETER_LIST>
> > <IOSC_FIELD_NAME>40259</IOSC_FIELD_NAME>
> > </IOSC_PARAMETER_LIST>
> > <IOSC_PARAMETER_LIST>
> > <IOSC_FIELD_NAME>40432</IOSC_FIELD_NAME>
> > </IOSC_PARAMETER_LIST>
> > <IOSC_PARAMETER_LIST>
> > <IOSC_FIELD_NAME>40613</IOSC_FIELD_NAME>
> > </IOSC_PARAMETER_LIST>
> > <INTRA_IXC>NPS</INTRA_IXC>
> > <INTER_IXC>NPS</INTER_IXC>
> > </FEATURE_RECORD_TYPE>
> > </VOICE_RECORDS>
> > </ADDRESS_GROUP>
> > </AddOrder>
> >
> > I have been able to use this XSLT to copy the XML... but not sure how to 
> > NOT
> > copy that node..
> > <?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" version="1.0" encoding="UTF-8" indent="yes"/>
> > <xsl:template match="/">
> > <xsl:copy-of select="/"> </xsl:copy-of>
> > </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > Please advise...
> > Thanks,
> > Tim Reynolds
> > Verizon 
> 
> 
> 


transparent
Print
Mail
Digg
delicious
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.

.
.

transparent

transparent