233:
442:), copying each node matched, then applying the identity transformation to all attributes and child nodes of the context node. This recursively descends the element tree and outputs all structures in the same structure they were found in the original file, within the limitations of what information is considered significant in the
1235:
The identity transformation can be modified to copy everything from an input tree to an output tree except a given node. For example, the following will copy everything from the input to the output except the social security number:
360:
The "copy with recursion" permits, changing little portions of code, produce entire new and different output, filtering or updating the input. Understanding the "identity by recursion" we can understand the filters.
514:
This version is equivalent to the first, but explicitly enumerates the types of XML nodes that it will copy. Both versions copy data that is unnecessary for most XML usage (e.g., comments).
569:
Finally, note that markup details, such as the use of CDATA sections or the order of attributes, are not necessarily preserved in the output, since this information is not part of the
1109:
The typeswitch transform is sometime preferable since it can easily be modified by simply adding a case statement for any element that needs special processing.
214:
250:
630:
can define recursive functions. The following example XQuery function copies the input directly to the output without modification.
1608:
316:
207:
526:
instruction that allows the identity transform to be declared rather than implemented as an explicit template rule. Specifically:
297:
566:
is essentially equivalent to the earlier template rules. See the XSLT 3.0 standard's description of shallow-copy for details.
369:
The most frequently cited example of the identity transform (for XSLT version 1.0) is the "copy.xsl" transform as expressed in
269:
56:
22:
254:
1675:
276:
89:
200:
591:
specifies a list of the names of elements whose text node children should be output using CDATA sections. For example:
109:
283:
243:
345:
265:
161:
66:
341:
188:
80:
450:
matches text, processing instructions, root, and comments, as well as elements, all XML nodes are copied.
573:. To show CDATA markup in the output, the XSLT stylesheet that contains the identity transform template (
1214:
identity, is that it can take either one document like this example or a sequence of document as input.
61:
1680:
334:
167:
1658:
290:
1604:
1222:
Generally the identity transform is used as a base on which one can make local modifications.
570:
443:
156:
146:
130:
373:. This transformation uses the xsl:copy command to perform the identity transformation:
344:. By creating a library of variations of the base identity transformation, a variety of
1617:, O'Reilly Media, Inc., Chapter 8 Functions – Recursive Functions – page 109
348:
can be easily maintained. These filters can be chained together in a format similar to
183:
151:
51:
340:
The identity transformation is considered an essential process in creating a reusable
1669:
1588:
1583:
71:
46:
41:
232:
1659:
W3.org - XSL Transformations
Version 3.0 - Built-in Templates: Shallow Copy
793:
The same function can also be achieved using a typeswitch-style transform.
1089:(: otherwise pass it through. Used for text(), comments, and PIs :)
36:
337:
that copies the source data into the destination data without change.
627:
99:
1636:
1211:
1041:(: output all the sub-elements of this element recursively :)
1647:
370:
349:
577:
the identity transform template itself) should make use of the
226:
104:
94:
810:(: copy the input to the output without modification :)
1603:, O'Reilly Media, Inc., December 1, 2002, by Sal Mangano,
497:"*|@*|text()|processing-instruction()|comment()"
453:
A more explicit version of the identity transform is:
1117:Two simple and illustrative "copy all" transforms.
522:XSLT 3.0 specifies an on-no-match attribute of the
482:"@*|*|processing-instruction()|comment()"
257:. Unsourced material may be challenged and removed.
1637:W3.org - XSL Transformations Version 1.0 - Copying
1632:
1630:
1274:<!-- remove all social security numbers -->
1139:"http://www.w3.org/1999/XSL/Transform"
975:(: output each attribute in this element :)
543:"http://www.w3.org/1999/XSL/Transform"
470:"http://www.w3.org/1999/XSL/Transform"
434:This template works by matching all attributes (
390:"http://www.w3.org/1999/XSL/Transform"
208:
8:
215:
201:
18:
614:"element-name-1 element-name-2"
317:Learn how and when to remove this message
1648:W3.org - XSL Transformations Version 3.0
1626:
175:
138:
117:
79:
28:
21:
1551:"http://www.w3.org/ns/xproc"
1196:"http://www.w3.org/ns/xproc"
7:
255:adding citations to reliable sources
1210:Here one important note about the
14:
356:Examples of recursive transforms
231:
242:needs additional citations for
1226:Remove named element transform
1:
1495:To call this one would add:
346:data transformation filters
16:Form of data transformation
1697:
1509:local:copy-filter-elements
1454:local:copy-filter-elements
1304:local:copy-filter-elements
118:Techniques and transforms
1536:
1497:
1295:
1238:
1181:
1124:
1113:Non-recursive transforms
795:
632:
593:
555:"shallow-copy"
528:
455:
375:
189:Transformation languages
162:Extract, transform, load
81:Transformation languages
1566:"PersonSSNID"
1283:"PersonSSNID"
1256:<xsl:apply-templates
1172:</xsl:stylesheet>
611:cdata-section-elements=
561:</xsl:stylesheet>
509:</xsl:stylesheet>
491:<xsl:apply-templates
429:</xsl:stylesheet>
411:<xsl:apply-templates
589:cdata-section-elements
583:cdata-section-elements
342:transformation library
1524:'PersonSSNID'
1271:</xsl:template>
1262:"@*|node()"
1247:"@*|node()"
1218:More complex examples
1169:</xsl:template>
506:</xsl:template>
426:</xsl:template>
417:"@*|node()"
402:"@*|node()"
1676:Computer programming
1613:Priscilla Walmsley,
1545:"pipeline"
1190:"pipeline"
266:"Identity transform"
251:improve this article
62:Model transformation
1572:</p:pipeline>
1557:<p:identity/>
1205:</p:pipeline>
1202:<p:identity/>
438:) and other nodes (
335:data transformation
168:Web template system
57:Data transformation
23:Data transformation
1127:<xsl:stylesheet
531:<xsl:stylesheet
458:<xsl:stylesheet
378:<xsl:stylesheet
331:identity transform
126:Identity transform
1268:</xsl:copy>
608:"utf-8"
581:attribute called
503:</xsl:copy>
423:</xsl:copy>
327:
326:
319:
301:
225:
224:
1688:
1661:
1656:
1650:
1645:
1639:
1634:
1573:
1570:
1567:
1564:
1561:
1558:
1555:
1552:
1549:
1546:
1543:
1540:
1528:
1525:
1522:
1519:
1516:
1513:
1510:
1507:
1504:
1501:
1491:
1488:
1485:
1482:
1479:
1476:
1473:
1470:
1467:
1464:
1461:
1458:
1455:
1452:
1449:
1446:
1443:
1440:
1437:
1434:
1431:
1428:
1425:
1422:
1419:
1416:
1413:
1410:
1407:
1404:
1401:
1398:
1395:
1392:
1389:
1386:
1383:
1380:
1377:
1374:
1371:
1368:
1365:
1362:
1359:
1356:
1353:
1350:
1347:
1344:
1341:
1338:
1335:
1332:
1329:
1326:
1323:
1320:
1317:
1314:
1311:
1308:
1305:
1302:
1299:
1287:
1284:
1281:
1278:
1277:<xsl:template
1275:
1272:
1269:
1266:
1263:
1260:
1257:
1254:
1253:<xsl:copy>
1251:
1248:
1245:
1242:
1241:<xsl:template
1206:
1203:
1200:
1197:
1194:
1191:
1188:
1185:
1173:
1170:
1167:
1164:
1161:
1158:
1155:
1152:
1149:
1146:
1145:<xsl:template
1143:
1140:
1137:
1134:
1131:
1128:
1105:
1102:
1099:
1096:
1093:
1090:
1087:
1084:
1081:
1078:
1075:
1072:
1069:
1066:
1063:
1060:
1057:
1054:
1051:
1048:
1045:
1042:
1039:
1036:
1033:
1030:
1027:
1024:
1021:
1018:
1015:
1012:
1009:
1006:
1003:
1000:
997:
994:
991:
988:
985:
982:
979:
976:
973:
970:
967:
964:
961:
958:
955:
952:
949:
946:
943:
940:
937:
934:
931:
928:
925:
922:
919:
916:
913:
910:
907:
904:
901:
898:
895:
892:
889:
886:
883:
880:
877:
874:
871:
868:
865:
862:
859:
856:
853:
850:
847:
844:
841:
838:
835:
832:
829:
826:
823:
820:
817:
814:
811:
808:
805:
802:
799:
789:
786:
783:
780:
777:
774:
771:
768:
765:
762:
759:
756:
753:
750:
747:
744:
741:
738:
735:
732:
729:
726:
723:
720:
717:
714:
711:
708:
705:
702:
699:
696:
693:
690:
687:
684:
681:
678:
675:
672:
669:
666:
663:
660:
657:
654:
651:
648:
645:
642:
639:
636:
618:
615:
612:
609:
606:
603:
600:
597:
590:
584:
580:
571:XPath data model
562:
559:
556:
553:
550:
547:
544:
541:
538:
535:
532:
525:
510:
507:
504:
501:
498:
495:
492:
489:
488:<xsl:copy>
486:
483:
480:
477:
476:<xsl:template
474:
471:
468:
465:
462:
459:
444:XPath data model
430:
427:
424:
421:
418:
415:
412:
409:
408:<xsl:copy>
406:
403:
400:
397:
396:<xsl:template
394:
391:
388:
385:
382:
379:
322:
315:
311:
308:
302:
300:
259:
235:
227:
217:
210:
203:
157:Data integration
19:
1696:
1695:
1691:
1690:
1689:
1687:
1686:
1685:
1666:
1665:
1664:
1657:
1653:
1646:
1642:
1635:
1628:
1624:
1597:
1595:Further reading
1580:
1575:
1574:
1571:
1568:
1565:
1562:
1559:
1556:
1553:
1550:
1547:
1544:
1541:
1538:
1535:
1530:
1529:
1526:
1523:
1520:
1517:
1514:
1511:
1508:
1505:
1503:filtered-output
1502:
1499:
1493:
1492:
1489:
1486:
1483:
1480:
1477:
1474:
1471:
1468:
1465:
1462:
1459:
1456:
1453:
1450:
1447:
1444:
1441:
1438:
1435:
1432:
1429:
1426:
1423:
1420:
1417:
1414:
1411:
1408:
1405:
1402:
1399:
1396:
1393:
1390:
1387:
1384:
1381:
1378:
1375:
1372:
1369:
1366:
1363:
1360:
1357:
1354:
1351:
1348:
1345:
1342:
1339:
1336:
1333:
1330:
1327:
1324:
1321:
1318:
1315:
1312:
1309:
1306:
1303:
1300:
1297:
1294:
1289:
1288:
1285:
1282:
1279:
1276:
1273:
1270:
1267:
1264:
1261:
1258:
1255:
1252:
1249:
1246:
1243:
1240:
1233:
1228:
1220:
1208:
1207:
1204:
1201:
1198:
1195:
1192:
1189:
1186:
1183:
1180:
1175:
1174:
1171:
1168:
1165:
1162:
1159:
1157:<xsl:copy-of
1156:
1153:
1150:
1147:
1144:
1141:
1138:
1135:
1133:"1.0"
1132:
1129:
1126:
1123:
1115:
1107:
1106:
1103:
1100:
1097:
1094:
1091:
1088:
1085:
1082:
1079:
1076:
1073:
1070:
1067:
1064:
1061:
1058:
1055:
1052:
1049:
1046:
1043:
1040:
1037:
1034:
1031:
1028:
1025:
1022:
1019:
1016:
1013:
1010:
1007:
1004:
1001:
998:
995:
992:
989:
986:
983:
980:
977:
974:
971:
968:
965:
962:
959:
956:
953:
950:
947:
944:
941:
938:
935:
932:
929:
926:
923:
920:
917:
914:
911:
908:
905:
902:
899:
896:
893:
890:
887:
884:
881:
878:
875:
872:
869:
866:
863:
860:
857:
854:
851:
848:
845:
842:
839:
836:
833:
830:
827:
824:
821:
818:
815:
812:
809:
806:
804:"1.0"
803:
800:
797:
791:
790:
787:
784:
781:
778:
775:
772:
769:
766:
763:
760:
757:
754:
751:
748:
745:
742:
739:
736:
733:
730:
727:
724:
721:
718:
715:
712:
709:
706:
703:
700:
697:
694:
691:
688:
685:
682:
679:
676:
673:
670:
667:
664:
661:
658:
655:
652:
649:
646:
643:
640:
637:
634:
625:
620:
619:
616:
613:
610:
607:
604:
602:"xml"
601:
598:
595:
588:
582:
578:
564:
563:
560:
557:
554:
551:
548:
545:
542:
539:
537:"3.0"
536:
533:
530:
523:
520:
512:
511:
508:
505:
502:
499:
496:
493:
490:
487:
484:
481:
478:
475:
472:
469:
466:
464:"1.0"
463:
460:
457:
432:
431:
428:
425:
422:
419:
416:
413:
410:
407:
404:
401:
398:
395:
392:
389:
386:
384:"1.0"
383:
380:
377:
367:
358:
323:
312:
306:
303:
260:
258:
248:
236:
221:
147:Data conversion
131:Data refinement
17:
12:
11:
5:
1694:
1692:
1684:
1683:
1678:
1668:
1667:
1663:
1662:
1651:
1640:
1625:
1623:
1620:
1619:
1618:
1611:
1596:
1593:
1592:
1591:
1586:
1579:
1576:
1539:<p:pipeline
1537:
1534:
1531:
1498:
1296:
1293:
1290:
1239:
1232:
1229:
1227:
1224:
1219:
1216:
1184:<p:pipeline
1182:
1179:
1176:
1125:
1122:
1119:
1114:
1111:
796:
633:
624:
621:
596:<xsl:output
594:
529:
519:
516:
456:
376:
366:
363:
357:
354:
325:
324:
239:
237:
230:
223:
222:
220:
219:
212:
205:
197:
194:
193:
192:
191:
186:
184:Data wrangling
178:
177:
173:
172:
171:
170:
165:
159:
154:
152:Data migration
149:
141:
140:
136:
135:
134:
133:
128:
120:
119:
115:
114:
113:
112:
107:
102:
97:
92:
84:
83:
77:
76:
75:
74:
69:
64:
59:
54:
52:Data migration
49:
44:
39:
31:
30:
26:
25:
15:
13:
10:
9:
6:
4:
3:
2:
1693:
1682:
1679:
1677:
1674:
1673:
1671:
1660:
1655:
1652:
1649:
1644:
1641:
1638:
1633:
1631:
1627:
1621:
1616:
1612:
1610:
1609:0-596-00372-2
1606:
1602:
1601:XSLT Cookbook
1599:
1598:
1594:
1590:
1587:
1585:
1582:
1581:
1577:
1532:
1496:
1291:
1237:
1230:
1225:
1223:
1217:
1215:
1213:
1177:
1163:"."
1151:"/"
1120:
1118:
1112:
1110:
900:document-node
794:
631:
629:
622:
592:
586:
576:
572:
567:
527:
517:
515:
454:
451:
449:
445:
441:
437:
374:
372:
364:
362:
355:
353:
352:shell pipes.
351:
347:
343:
338:
336:
332:
321:
318:
310:
307:December 2022
299:
296:
292:
289:
285:
282:
278:
275:
271:
268: –
267:
263:
262:Find sources:
256:
252:
246:
245:
240:This article
238:
234:
229:
228:
218:
213:
211:
206:
204:
199:
198:
196:
195:
190:
187:
185:
182:
181:
180:
179:
174:
169:
166:
163:
160:
158:
155:
153:
150:
148:
145:
144:
143:
142:
137:
132:
129:
127:
124:
123:
122:
121:
116:
111:
110:XML languages
108:
106:
103:
101:
98:
96:
93:
91:
88:
87:
86:
85:
82:
78:
73:
70:
68:
65:
63:
60:
58:
55:
53:
50:
48:
45:
43:
40:
38:
35:
34:
33:
32:
27:
24:
20:
1654:
1643:
1614:
1600:
1589:XML pipeline
1584:Data mapping
1560:<p:delete
1494:
1472:element-name
1328:element-name
1292:Using XQuery
1234:
1221:
1209:
1116:
1108:
792:
626:
623:Using XQuery
587:
574:
568:
565:
552:on-no-match=
549:<xsl:mode
521:
513:
452:
447:
439:
435:
433:
368:
359:
339:
330:
328:
313:
304:
294:
287:
280:
273:
261:
249:Please help
244:verification
241:
139:Applications
125:
72:Preprocessor
47:Data mapping
42:Data element
1533:Using XProc
1178:Using XProc
1681:Transforms
1670:Categories
1622:References
1231:Using XSLT
1136:xmlns:xsl=
1121:Using XSLT
1065:local:copy
915:local:copy
882:typeswitch
819:local:copy
761:local:copy
641:local:copy
579:xsl:output
540:xmlns:xsl=
467:xmlns:xsl=
387:xmlns:xsl=
365:Using XSLT
277:newspapers
1361:node-name
1334:xs:string
1005:attribute
671:node-name
605:encoding=
1578:See also
1548:xmlns:p=
1439:instance
1301:function
1193:xmlns:p=
1130:version=
909:document
816:function
746:instance
638:function
534:version=
524:xsl:mode
518:XSLT 3.0
461:version=
446:. Since
381:version=
37:Metadata
29:Concepts
1445:element
1412:element
1385:element
1370:element
1355:element
1346:element
1319:element
1313:element
1298:declare
1259:select=
1160:select=
1092:default
951:element
942:element
813:declare
801:version
752:element
719:element
692:element
680:element
665:element
656:element
650:element
635:declare
599:method=
494:select=
414:select=
291:scholar
176:Related
1615:XQuery
1607:
1563:match=
1424:return
1280:match=
1244:match=
1148:match=
1095:return
1062:return
1002:return
948:return
906:return
879:return
798:xquery
731:return
628:XQuery
479:match=
448:node()
440:node()
399:match=
293:
286:
279:
272:
264:
100:MOFM2T
1569:/>
1542:name=
1518:input
1484:child
1463:child
1436:child
1403:child
1286:/>
1265:/>
1212:XProc
1187:name=
1166:/>
1074:child
1050:child
876:input
828:input
782:child
770:child
743:child
710:child
617:/>
558:/>
500:/>
420:/>
333:is a
298:JSTOR
284:books
164:(ETL)
67:Macro
1605:ISBN
1554:>
1478:else
1451:then
1418:node
1250:>
1199:>
1154:>
1142:>
1101:node
1080:node
1059:node
1011:name
993:node
966:node
957:name
939:case
930:node
924:node
897:case
891:node
867:node
849:item
834:item
776:else
758:then
725:node
546:>
485:>
473:>
405:>
393:>
371:XSLT
350:UNIX
329:The
270:news
1448:())
1397:for
1322:(),
1083:())
1044:for
1032:att
1020:att
984:att
978:for
933:())
861:for
755:())
704:for
659:())
575:not
253:by
105:QVT
95:AWK
90:ATL
1672::
1629:^
1515:$
1506::=
1500:$
1490:};
1481:$
1469:$
1460:$
1442:of
1433:$
1427:if
1421:()
1409:$
1406:in
1400:$
1391:@*
1382:$
1367:$
1349:()
1343:as
1331:as
1325:$
1316:as
1310:$
1104:};
1098:$
1071:$
1056:$
1053:in
1047:$
1029:$
1023:)}
1017:$
999:@*
990:$
987:in
981:$
969:)}
963:$
945:()
921:$
903:()
888:$
873:$
870:in
864:$
852:()
846:as
837:()
831:as
825:$
788:};
779:$
767:$
749:of
740:$
734:if
728:()
716:$
713:in
707:$
698:@*
689:$
683:)}
677:$
653:as
647:$
585:.
436:@*
1527:)
1521:,
1512:(
1487:}
1475:)
1466:,
1457:(
1430:(
1415:/
1394:,
1388:/
1379:{
1376:}
1373:)
1364:(
1358:{
1352:{
1340:)
1337:*
1307:(
1086:}
1077:/
1068:(
1038:,
1035:}
1026:{
1014:(
1008:{
996:/
972:{
960:(
954:{
936:}
927:/
918:(
912:{
894:)
885:(
858:{
855:*
843:)
840:*
822:(
807:;
785:}
773:)
764:(
737:(
722:/
701:,
695:/
686:{
674:(
668:{
662:{
644:(
320:)
314:(
309:)
305:(
295:·
288:·
281:·
274:·
247:.
216:e
209:t
202:v
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.