File indexing completed on 2024-11-15 09:44:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef __XML_XSLT_INTERNALS_H__
0014 #define __XML_XSLT_INTERNALS_H__
0015
0016 #include <libxml/tree.h>
0017 #include <libxml/hash.h>
0018 #include <libxml/xpath.h>
0019 #include <libxml/xmlerror.h>
0020 #include <libxml/dict.h>
0021 #include <libxml/xmlstring.h>
0022 #include <libxslt/xslt.h>
0023 #include "xsltexports.h"
0024 #include "xsltlocale.h"
0025 #include "numbersInternals.h"
0026
0027 #ifdef __cplusplus
0028 extern "C" {
0029 #endif
0030
0031
0032
0033
0034
0035
0036
0037
0038 #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
0039 (((n)->type == XML_TEXT_NODE) || \
0040 ((n)->type == XML_CDATA_SECTION_NODE)))
0041
0042
0043
0044
0045
0046
0047
0048 #define XSLT_MARK_RES_TREE_FRAG(n) \
0049 (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
0050
0051
0052
0053
0054
0055
0056 #define XSLT_IS_RES_TREE_FRAG(n) \
0057 ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
0058 ((n)->name != NULL) && ((n)->name[0] == ' '))
0059
0060
0061
0062
0063
0064
0065
0066 #define XSLT_REFACTORED_KEYCOMP
0067
0068
0069
0070
0071
0072
0073
0074 #define XSLT_FAST_IF
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 #define XSLT_REFACTORED_VARS
0090
0091 #ifdef XSLT_REFACTORED
0092
0093 extern const xmlChar *xsltXSLTAttrMarker;
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 #define XSLT_REFACTORED_XPATHCOMP
0115
0116 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
0117
0118 extern const xmlChar *xsltConstNamespaceNameXSLT;
0119
0120
0121
0122
0123
0124
0125 #define IS_XSLT_ELEM_FAST(n) \
0126 (((n) != NULL) && ((n)->ns != NULL) && \
0127 ((n)->ns->href == xsltConstNamespaceNameXSLT))
0128
0129
0130
0131
0132
0133
0134 #define IS_XSLT_ATTR_FAST(a) \
0135 (((a) != NULL) && ((a)->ns != NULL) && \
0136 ((a)->ns->href == xsltConstNamespaceNameXSLT))
0137
0138
0139
0140
0141
0142
0143 #define XSLT_HAS_INTERNAL_NSMAP(s) \
0144 (((s) != NULL) && ((s)->principal) && \
0145 ((s)->principal->principalData) && \
0146 ((s)->principal->principalData->nsMap))
0147
0148
0149
0150
0151
0152
0153 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
0154
0155 #else
0156
0157
0158
0159
0160
0161
0162 #define IS_XSLT_ELEM_FAST(n) \
0163 (((n) != NULL) && ((n)->ns != NULL) && \
0164 (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
0165
0166
0167
0168
0169
0170
0171 #define IS_XSLT_ATTR_FAST(a) \
0172 (((a) != NULL) && ((a)->ns != NULL) && \
0173 (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
0174
0175
0176 #endif
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194 typedef struct _xsltPointerList xsltPointerList;
0195 typedef xsltPointerList *xsltPointerListPtr;
0196 struct _xsltPointerList {
0197 void **items;
0198 int number;
0199 int size;
0200 };
0201
0202 #endif
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217 #define XSLT_MAX_SORT 15
0218
0219
0220
0221
0222
0223
0224 #define XSLT_PAT_NO_PRIORITY -12345789
0225
0226
0227
0228
0229
0230
0231 typedef struct _xsltRuntimeExtra xsltRuntimeExtra;
0232 typedef xsltRuntimeExtra *xsltRuntimeExtraPtr;
0233 struct _xsltRuntimeExtra {
0234 void *info;
0235 xmlFreeFunc deallocate;
0236 union {
0237 void *ptr;
0238 int ival;
0239 } val;
0240 };
0241
0242
0243
0244
0245
0246
0247
0248
0249 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
0250
0251
0252
0253
0254
0255
0256
0257 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
0258
0259
0260
0261
0262
0263
0264
0265 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
0266
0267
0268
0269
0270
0271
0272 typedef struct _xsltTemplate xsltTemplate;
0273 typedef xsltTemplate *xsltTemplatePtr;
0274 struct _xsltTemplate {
0275 struct _xsltTemplate *next;
0276 struct _xsltStylesheet *style;
0277 xmlChar *match;
0278 float priority;
0279 const xmlChar *name;
0280 const xmlChar *nameURI;
0281 const xmlChar *mode;
0282 const xmlChar *modeURI;
0283 xmlNodePtr content;
0284 xmlNodePtr elem;
0285
0286
0287
0288
0289
0290 int inheritedNsNr;
0291 xmlNsPtr *inheritedNs;
0292
0293
0294 int nbCalls;
0295 unsigned long time;
0296 void *params;
0297
0298 int templNr;
0299 int templMax;
0300 xsltTemplatePtr *templCalledTab;
0301 int *templCountTab;
0302 };
0303
0304
0305
0306
0307
0308
0309 typedef struct _xsltDecimalFormat xsltDecimalFormat;
0310 typedef xsltDecimalFormat *xsltDecimalFormatPtr;
0311 struct _xsltDecimalFormat {
0312 struct _xsltDecimalFormat *next;
0313 xmlChar *name;
0314
0315 xmlChar *digit;
0316 xmlChar *patternSeparator;
0317
0318 xmlChar *minusSign;
0319 xmlChar *infinity;
0320 xmlChar *noNumber;
0321
0322 xmlChar *decimalPoint;
0323 xmlChar *grouping;
0324 xmlChar *percent;
0325 xmlChar *permille;
0326 xmlChar *zeroDigit;
0327 const xmlChar *nsUri;
0328 };
0329
0330
0331
0332
0333
0334
0335 typedef struct _xsltDocument xsltDocument;
0336 typedef xsltDocument *xsltDocumentPtr;
0337 struct _xsltDocument {
0338 struct _xsltDocument *next;
0339 int main;
0340 xmlDocPtr doc;
0341 void *keys;
0342 struct _xsltDocument *includes;
0343 int preproc;
0344 int nbKeysComputed;
0345 };
0346
0347
0348
0349
0350
0351
0352 typedef struct _xsltKeyDef xsltKeyDef;
0353 typedef xsltKeyDef *xsltKeyDefPtr;
0354 struct _xsltKeyDef {
0355 struct _xsltKeyDef *next;
0356 xmlNodePtr inst;
0357 xmlChar *name;
0358 xmlChar *nameURI;
0359 xmlChar *match;
0360 xmlChar *use;
0361 xmlXPathCompExprPtr comp;
0362 xmlXPathCompExprPtr usecomp;
0363 xmlNsPtr *nsList;
0364 int nsNr;
0365 };
0366
0367
0368
0369
0370
0371
0372
0373 typedef struct _xsltKeyTable xsltKeyTable;
0374 typedef xsltKeyTable *xsltKeyTablePtr;
0375 struct _xsltKeyTable {
0376 struct _xsltKeyTable *next;
0377 xmlChar *name;
0378 xmlChar *nameURI;
0379 xmlHashTablePtr keys;
0380 };
0381
0382
0383
0384
0385
0386
0387 typedef struct _xsltStylesheet xsltStylesheet;
0388 typedef xsltStylesheet *xsltStylesheetPtr;
0389
0390 typedef struct _xsltTransformContext xsltTransformContext;
0391 typedef xsltTransformContext *xsltTransformContextPtr;
0392
0393
0394
0395
0396
0397
0398
0399 typedef struct _xsltElemPreComp xsltElemPreComp;
0400 typedef xsltElemPreComp *xsltElemPreCompPtr;
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412 typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt,
0413 xmlNodePtr node,
0414 xmlNodePtr inst,
0415 xsltElemPreCompPtr comp);
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425 typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
0426 int nbsorts);
0427
0428 typedef enum {
0429 XSLT_FUNC_COPY=1,
0430 XSLT_FUNC_SORT,
0431 XSLT_FUNC_TEXT,
0432 XSLT_FUNC_ELEMENT,
0433 XSLT_FUNC_ATTRIBUTE,
0434 XSLT_FUNC_COMMENT,
0435 XSLT_FUNC_PI,
0436 XSLT_FUNC_COPYOF,
0437 XSLT_FUNC_VALUEOF,
0438 XSLT_FUNC_NUMBER,
0439 XSLT_FUNC_APPLYIMPORTS,
0440 XSLT_FUNC_CALLTEMPLATE,
0441 XSLT_FUNC_APPLYTEMPLATES,
0442 XSLT_FUNC_CHOOSE,
0443 XSLT_FUNC_IF,
0444 XSLT_FUNC_FOREACH,
0445 XSLT_FUNC_DOCUMENT,
0446 XSLT_FUNC_WITHPARAM,
0447 XSLT_FUNC_PARAM,
0448 XSLT_FUNC_VARIABLE,
0449 XSLT_FUNC_WHEN,
0450 XSLT_FUNC_EXTENSION
0451 #ifdef XSLT_REFACTORED
0452 ,
0453 XSLT_FUNC_OTHERWISE,
0454 XSLT_FUNC_FALLBACK,
0455 XSLT_FUNC_MESSAGE,
0456 XSLT_FUNC_INCLUDE,
0457 XSLT_FUNC_ATTRSET,
0458 XSLT_FUNC_LITERAL_RESULT_ELEMENT,
0459 XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
0460 #endif
0461 } xsltStyleType;
0462
0463
0464
0465
0466
0467
0468
0469 typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp);
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479 struct _xsltElemPreComp {
0480 xsltElemPreCompPtr next;
0481
0482 xsltStyleType type;
0483 xsltTransformFunction func;
0484 xmlNodePtr inst;
0485
0486
0487
0488 xsltElemPreCompDeallocator free;
0489 };
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500 typedef struct _xsltStylePreComp xsltStylePreComp;
0501 typedef xsltStylePreComp *xsltStylePreCompPtr;
0502
0503 #ifdef XSLT_REFACTORED
0504
0505
0506
0507
0508 XSLTPUBFUN xsltPointerListPtr XSLTCALL
0509 xsltPointerListCreate (int initialSize);
0510 XSLTPUBFUN void XSLTCALL
0511 xsltPointerListFree (xsltPointerListPtr list);
0512 XSLTPUBFUN void XSLTCALL
0513 xsltPointerListClear (xsltPointerListPtr list);
0514 XSLTPUBFUN int XSLTCALL
0515 xsltPointerListAddSize (xsltPointerListPtr list,
0516 void *item,
0517 int initialSize);
0518
0519
0520
0521
0522
0523
0524
0525 typedef struct _xsltNsListContainer xsltNsListContainer;
0526 typedef xsltNsListContainer *xsltNsListContainerPtr;
0527 struct _xsltNsListContainer {
0528 xmlNsPtr *list;
0529 int totalNumber;
0530 int xpathNumber;
0531 };
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542 #define XSLT_ITEM_COMPATIBILITY_FIELDS \
0543 xsltElemPreCompPtr next;\
0544 xsltStyleType type;\
0545 xsltTransformFunction func;\
0546 xmlNodePtr inst;
0547
0548
0549
0550
0551
0552
0553
0554 #define XSLT_ITEM_NAVIGATION_FIELDS
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
0567
0568
0569
0570
0571
0572
0573 #define XSLT_ITEM_COMMON_FIELDS \
0574 XSLT_ITEM_COMPATIBILITY_FIELDS \
0575 XSLT_ITEM_NAVIGATION_FIELDS \
0576 XSLT_ITEM_NSINSCOPE_FIELDS
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591 struct _xsltStylePreComp {
0592 xsltElemPreCompPtr next;
0593
0594 xsltStyleType type;
0595 xsltTransformFunction func;
0596 xmlNodePtr inst;
0597
0598
0599 xsltNsListContainerPtr inScopeNs;
0600 };
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem;
0611 typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr;
0612
0613 struct _xsltStyleBasicEmptyItem {
0614 XSLT_ITEM_COMMON_FIELDS
0615 };
0616
0617
0618
0619
0620
0621
0622
0623 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem;
0624 typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr;
0625
0626 struct _xsltStyleBasicExpressionItem {
0627 XSLT_ITEM_COMMON_FIELDS
0628
0629 const xmlChar *select;
0630 xmlXPathCompExprPtr comp;
0631 };
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650 typedef struct _xsltStyleItemElement xsltStyleItemElement;
0651 typedef xsltStyleItemElement *xsltStyleItemElementPtr;
0652
0653 struct _xsltStyleItemElement {
0654 XSLT_ITEM_COMMON_FIELDS
0655
0656 const xmlChar *use;
0657 int has_use;
0658 const xmlChar *name;
0659 int has_name;
0660 const xmlChar *ns;
0661 const xmlChar *nsPrefix;
0662 int has_ns;
0663 };
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute;
0676 typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr;
0677
0678 struct _xsltStyleItemAttribute {
0679 XSLT_ITEM_COMMON_FIELDS
0680 const xmlChar *name;
0681 int has_name;
0682 const xmlChar *ns;
0683 const xmlChar *nsPrefix;
0684 int has_ns;
0685 };
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696 typedef struct _xsltStyleItemText xsltStyleItemText;
0697 typedef xsltStyleItemText *xsltStyleItemTextPtr;
0698
0699 struct _xsltStyleItemText {
0700 XSLT_ITEM_COMMON_FIELDS
0701 int noescape;
0702 };
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712 typedef xsltStyleBasicEmptyItem xsltStyleItemComment;
0713 typedef xsltStyleItemComment *xsltStyleItemCommentPtr;
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724 typedef struct _xsltStyleItemPI xsltStyleItemPI;
0725 typedef xsltStyleItemPI *xsltStyleItemPIPtr;
0726
0727 struct _xsltStyleItemPI {
0728 XSLT_ITEM_COMMON_FIELDS
0729 const xmlChar *name;
0730 int has_name;
0731 };
0732
0733
0734
0735
0736
0737
0738
0739 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports;
0740 typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr;
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates;
0753 typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr;
0754
0755 struct _xsltStyleItemApplyTemplates {
0756 XSLT_ITEM_COMMON_FIELDS
0757
0758 const xmlChar *mode;
0759 const xmlChar *modeURI;
0760 const xmlChar *select;
0761 xmlXPathCompExprPtr comp;
0762
0763 };
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate;
0775 typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr;
0776
0777 struct _xsltStyleItemCallTemplate {
0778 XSLT_ITEM_COMMON_FIELDS
0779
0780 xsltTemplatePtr templ;
0781 const xmlChar *name;
0782 int has_name;
0783 const xmlChar *ns;
0784 int has_ns;
0785
0786 };
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797 typedef struct _xsltStyleItemCopy xsltStyleItemCopy;
0798 typedef xsltStyleItemCopy *xsltStyleItemCopyPtr;
0799
0800 struct _xsltStyleItemCopy {
0801 XSLT_ITEM_COMMON_FIELDS
0802 const xmlChar *use;
0803 int has_use;
0804 };
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815 typedef struct _xsltStyleItemIf xsltStyleItemIf;
0816 typedef xsltStyleItemIf *xsltStyleItemIfPtr;
0817
0818 struct _xsltStyleItemIf {
0819 XSLT_ITEM_COMMON_FIELDS
0820
0821 const xmlChar *test;
0822 xmlXPathCompExprPtr comp;
0823 };
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf;
0834 typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr;
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf;
0845 typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr;
0846
0847 struct _xsltStyleItemValueOf {
0848 XSLT_ITEM_COMMON_FIELDS
0849
0850 const xmlChar *select;
0851 xmlXPathCompExprPtr comp;
0852 int noescape;
0853 };
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870 typedef struct _xsltStyleItemNumber xsltStyleItemNumber;
0871 typedef xsltStyleItemNumber *xsltStyleItemNumberPtr;
0872
0873 struct _xsltStyleItemNumber {
0874 XSLT_ITEM_COMMON_FIELDS
0875 xsltNumberData numdata;
0876 };
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose;
0887 typedef xsltStyleItemChoose *xsltStyleItemChoosePtr;
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback;
0898 typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr;
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach;
0910 typedef xsltStyleItemForEach *xsltStyleItemForEachPtr;
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921 typedef struct _xsltStyleItemMessage xsltStyleItemMessage;
0922 typedef xsltStyleItemMessage *xsltStyleItemMessagePtr;
0923
0924 struct _xsltStyleItemMessage {
0925 XSLT_ITEM_COMMON_FIELDS
0926 int terminate;
0927 };
0928
0929
0930
0931
0932
0933
0934 typedef struct _xsltStyleItemDocument xsltStyleItemDocument;
0935 typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr;
0936
0937 struct _xsltStyleItemDocument {
0938 XSLT_ITEM_COMMON_FIELDS
0939 int ver11;
0940
0941
0942 const xmlChar *filename;
0943 int has_filename;
0944 };
0945
0946
0947
0948
0949
0950
0951
0952
0953
0954
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable;
0965 typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr;
0966
0967 struct _xsltStyleBasicItemVariable {
0968 XSLT_ITEM_COMMON_FIELDS
0969
0970 const xmlChar *select;
0971 xmlXPathCompExprPtr comp;
0972
0973 const xmlChar *name;
0974 int has_name;
0975 const xmlChar *ns;
0976 int has_ns;
0977 };
0978
0979
0980
0981
0982
0983
0984
0985
0986
0987
0988
0989 typedef xsltStyleBasicItemVariable xsltStyleItemVariable;
0990 typedef xsltStyleItemVariable *xsltStyleItemVariablePtr;
0991
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002 typedef struct _xsltStyleItemParam xsltStyleItemParam;
1003 typedef xsltStyleItemParam *xsltStyleItemParamPtr;
1004
1005 struct _xsltStyleItemParam {
1006 XSLT_ITEM_COMMON_FIELDS
1007
1008 const xmlChar *select;
1009 xmlXPathCompExprPtr comp;
1010
1011 const xmlChar *name;
1012 int has_name;
1013 const xmlChar *ns;
1014 int has_ns;
1015 };
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam;
1027 typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr;
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041 typedef struct _xsltStyleItemSort xsltStyleItemSort;
1042 typedef xsltStyleItemSort *xsltStyleItemSortPtr;
1043
1044 struct _xsltStyleItemSort {
1045 XSLT_ITEM_COMMON_FIELDS
1046
1047 const xmlChar *stype;
1048 int has_stype;
1049 int number;
1050 const xmlChar *order;
1051 int has_order;
1052 int descending;
1053 const xmlChar *lang;
1054 int has_lang;
1055 xsltLocale locale;
1056 const xmlChar *case_order;
1057 int lower_first;
1058
1059 const xmlChar *use;
1060 int has_use;
1061
1062 const xmlChar *select;
1063
1064 xmlXPathCompExprPtr comp;
1065 };
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077 typedef struct _xsltStyleItemWhen xsltStyleItemWhen;
1078 typedef xsltStyleItemWhen *xsltStyleItemWhenPtr;
1079
1080 struct _xsltStyleItemWhen {
1081 XSLT_ITEM_COMMON_FIELDS
1082
1083 const xmlChar *test;
1084 xmlXPathCompExprPtr comp;
1085 };
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise;
1096 typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr;
1097
1098 struct _xsltStyleItemOtherwise {
1099 XSLT_ITEM_COMMON_FIELDS
1100 };
1101
1102 typedef struct _xsltStyleItemInclude xsltStyleItemInclude;
1103 typedef xsltStyleItemInclude *xsltStyleItemIncludePtr;
1104
1105 struct _xsltStyleItemInclude {
1106 XSLT_ITEM_COMMON_FIELDS
1107 xsltDocumentPtr include;
1108 };
1109
1110
1111
1112
1113
1114
1115
1116 typedef struct _xsltStyleItemUknown xsltStyleItemUknown;
1117 typedef xsltStyleItemUknown *xsltStyleItemUknownPtr;
1118 struct _xsltStyleItemUknown {
1119 XSLT_ITEM_COMMON_FIELDS
1120 };
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement;
1150 typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
1151 struct _xsltStyleItemExtElement {
1152 XSLT_ITEM_COMMON_FIELDS
1153 xsltElemPreCompPtr item;
1154 };
1155
1156
1157
1158
1159
1160
1161
1162 typedef struct _xsltEffectiveNs xsltEffectiveNs;
1163 typedef xsltEffectiveNs *xsltEffectiveNsPtr;
1164 struct _xsltEffectiveNs {
1165 xsltEffectiveNsPtr nextInStore;
1166 xsltEffectiveNsPtr next;
1167 const xmlChar *prefix;
1168 const xmlChar *nsName;
1169
1170
1171
1172
1173 int holdByElem;
1174 };
1175
1176
1177
1178
1179
1180
1181
1182
1183 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo;
1184 typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr;
1185 struct _xsltStyleItemLRElementInfo {
1186 XSLT_ITEM_COMMON_FIELDS
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196 xsltEffectiveNsPtr effectiveNs;
1197
1198 };
1199
1200 #ifdef XSLT_REFACTORED
1201
1202 typedef struct _xsltNsAlias xsltNsAlias;
1203 typedef xsltNsAlias *xsltNsAliasPtr;
1204 struct _xsltNsAlias {
1205 xsltNsAliasPtr next;
1206 xmlNsPtr literalNs;
1207 xmlNsPtr targetNs;
1208 xmlDocPtr docOfTargetNs;
1209 };
1210 #endif
1211
1212 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1213
1214 typedef struct _xsltNsMap xsltNsMap;
1215 typedef xsltNsMap *xsltNsMapPtr;
1216 struct _xsltNsMap {
1217 xsltNsMapPtr next;
1218 xmlDocPtr doc;
1219 xmlNodePtr elem;
1220 xmlNsPtr ns;
1221 const xmlChar *origNsName;
1222 const xmlChar *newNsName;
1223 };
1224 #endif
1225
1226
1227
1228
1229
1230
1231
1232 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData;
1233 typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr;
1234
1235 typedef struct _xsltNsList xsltNsList;
1236 typedef xsltNsList *xsltNsListPtr;
1237 struct _xsltNsList {
1238 xsltNsListPtr next;
1239 xmlNsPtr ns;
1240 };
1241
1242
1243
1244
1245
1246
1247 typedef struct _xsltVarInfo xsltVarInfo;
1248 typedef xsltVarInfo *xsltVarInfoPtr;
1249 struct _xsltVarInfo {
1250 xsltVarInfoPtr next;
1251 xsltVarInfoPtr prev;
1252 int depth;
1253 const xmlChar *name;
1254 const xmlChar *nsName;
1255 };
1256
1257
1258
1259
1260
1261
1262 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo;
1263 typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr;
1264 struct _xsltCompilerNodeInfo {
1265 xsltCompilerNodeInfoPtr next;
1266 xsltCompilerNodeInfoPtr prev;
1267 xmlNodePtr node;
1268 int depth;
1269 xsltTemplatePtr templ;
1270 int category;
1271
1272 xsltStyleType type;
1273 xsltElemPreCompPtr item;
1274
1275 xsltNsListContainerPtr inScopeNs;
1276
1277 xsltPointerListPtr exclResultNs;
1278
1279 xsltPointerListPtr extElemNs;
1280
1281
1282 xsltStyleItemLRElementInfoPtr litResElemInfo;
1283
1284
1285
1286
1287
1288
1289
1290 int nsChanged;
1291 int preserveWhitespace;
1292 int stripWhitespace;
1293 int isRoot;
1294 int forwardsCompat;
1295
1296 int extContentHandled;
1297
1298 xsltStyleType curChildType;
1299 };
1300
1301
1302
1303
1304
1305
1306 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
1307
1308 typedef enum {
1309 XSLT_ERROR_SEVERITY_ERROR = 0,
1310 XSLT_ERROR_SEVERITY_WARNING
1311 } xsltErrorSeverityType;
1312
1313 typedef struct _xsltCompilerCtxt xsltCompilerCtxt;
1314 typedef xsltCompilerCtxt *xsltCompilerCtxtPtr;
1315 struct _xsltCompilerCtxt {
1316 void *errorCtxt;
1317
1318
1319 xsltErrorSeverityType errSeverity;
1320 int warnings;
1321
1322 int errors;
1323
1324 xmlDictPtr dict;
1325 xsltStylesheetPtr style;
1326 int simplified;
1327
1328 int depth;
1329
1330 xsltCompilerNodeInfoPtr inode;
1331 xsltCompilerNodeInfoPtr inodeList;
1332 xsltCompilerNodeInfoPtr inodeLast;
1333 xsltPointerListPtr tmpList;
1334
1335
1336
1337 int isInclude;
1338 int hasForwardsCompat;
1339
1340 int maxNodeInfos;
1341 int maxLREs;
1342
1343
1344
1345
1346
1347 int strict;
1348 xsltPrincipalStylesheetDataPtr psData;
1349 #ifdef XSLT_REFACTORED_XPATHCOMP
1350 xmlXPathContextPtr xpathCtxt;
1351 #endif
1352 xsltStyleItemUknownPtr unknownItem;
1353 int hasNsAliases;
1354 xsltNsAliasPtr nsAliases;
1355 xsltVarInfoPtr ivars;
1356 xsltVarInfoPtr ivar;
1357 };
1358
1359 #else
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370 struct _xsltStylePreComp {
1371 xsltElemPreCompPtr next;
1372 xsltStyleType type;
1373 xsltTransformFunction func;
1374 xmlNodePtr inst;
1375
1376
1377
1378
1379
1380 const xmlChar *stype;
1381 int has_stype;
1382 int number;
1383 const xmlChar *order;
1384 int has_order;
1385 int descending;
1386 const xmlChar *lang;
1387 int has_lang;
1388 xsltLocale locale;
1389 const xmlChar *case_order;
1390 int lower_first;
1391
1392 const xmlChar *use;
1393 int has_use;
1394
1395 int noescape;
1396
1397 const xmlChar *name;
1398 int has_name;
1399 const xmlChar *ns;
1400 int has_ns;
1401
1402 const xmlChar *mode;
1403 const xmlChar *modeURI;
1404
1405 const xmlChar *test;
1406
1407 xsltTemplatePtr templ;
1408
1409 const xmlChar *select;
1410
1411 int ver11;
1412 const xmlChar *filename;
1413 int has_filename;
1414
1415 xsltNumberData numdata;
1416
1417 xmlXPathCompExprPtr comp;
1418 xmlNsPtr *nsList;
1419 int nsNr;
1420 };
1421
1422 #endif
1423
1424
1425
1426
1427
1428
1429 typedef struct _xsltStackElem xsltStackElem;
1430 typedef xsltStackElem *xsltStackElemPtr;
1431 struct _xsltStackElem {
1432 struct _xsltStackElem *next;
1433 xsltStylePreCompPtr comp;
1434 int computed;
1435 const xmlChar *name;
1436 const xmlChar *nameURI;
1437 const xmlChar *select;
1438 xmlNodePtr tree;
1439
1440 xmlXPathObjectPtr value;
1441 xmlDocPtr fragment;
1442
1443 int level;
1444
1445 xsltTransformContextPtr context;
1446
1447 int flags;
1448 };
1449
1450 #ifdef XSLT_REFACTORED
1451
1452 struct _xsltPrincipalStylesheetData {
1453
1454
1455
1456
1457
1458 xmlDictPtr namespaceDict;
1459
1460
1461
1462 xsltPointerListPtr inScopeNamespaces;
1463
1464
1465
1466 xsltPointerListPtr exclResultNamespaces;
1467
1468
1469
1470 xsltPointerListPtr extElemNamespaces;
1471 xsltEffectiveNsPtr effectiveNs;
1472 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1473
1474
1475
1476 xsltNsMapPtr nsMap;
1477 #endif
1478 };
1479
1480
1481 #endif
1482
1483
1484
1485
1486
1487 struct _xsltStylesheet {
1488
1489
1490
1491 struct _xsltStylesheet *parent;
1492 struct _xsltStylesheet *next;
1493 struct _xsltStylesheet *imports;
1494
1495 xsltDocumentPtr docList;
1496
1497
1498
1499
1500 xmlDocPtr doc;
1501 xmlHashTablePtr stripSpaces;
1502
1503 int stripAll;
1504 xmlHashTablePtr cdataSection;
1505
1506
1507
1508
1509 xsltStackElemPtr variables;
1510
1511
1512
1513
1514 xsltTemplatePtr templates;
1515 void *templatesHash;
1516
1517 void *rootMatch;
1518 void *keyMatch;
1519 void *elemMatch;
1520 void *attrMatch;
1521 void *parentMatch;
1522 void *textMatch;
1523 void *piMatch;
1524 void *commentMatch;
1525
1526
1527
1528
1529
1530 xmlHashTablePtr nsAliases;
1531
1532
1533
1534
1535 xmlHashTablePtr attributeSets;
1536
1537
1538
1539
1540
1541 xmlHashTablePtr nsHash;
1542
1543
1544
1545
1546
1547
1548 void *nsDefs;
1549
1550
1551
1552
1553
1554
1555
1556 void *keys;
1557
1558
1559
1560
1561 xmlChar *method;
1562 xmlChar *methodURI;
1563 xmlChar *version;
1564 xmlChar *encoding;
1565 int omitXmlDeclaration;
1566
1567
1568
1569
1570 xsltDecimalFormatPtr decimalFormat;
1571 int standalone;
1572 xmlChar *doctypePublic;
1573 xmlChar *doctypeSystem;
1574 int indent;
1575 xmlChar *mediaType;
1576
1577
1578
1579
1580 xsltElemPreCompPtr preComps;
1581 int warnings;
1582 int errors;
1583
1584 xmlChar *exclPrefix;
1585 xmlChar **exclPrefixTab;
1586 int exclPrefixNr;
1587 int exclPrefixMax;
1588
1589 void *_private;
1590
1591
1592
1593
1594 xmlHashTablePtr extInfos;
1595 int extrasNr;
1596
1597
1598
1599
1600 xsltDocumentPtr includes;
1601
1602
1603
1604
1605 xmlDictPtr dict;
1606
1607
1608
1609 void *attVTs;
1610
1611
1612
1613
1614 const xmlChar *defaultAlias;
1615
1616
1617
1618 int nopreproc;
1619
1620
1621
1622 int internalized;
1623
1624
1625
1626 int literal_result;
1627
1628
1629
1630 xsltStylesheetPtr principal;
1631 #ifdef XSLT_REFACTORED
1632
1633
1634
1635 xsltCompilerCtxtPtr compCtxt;
1636
1637 xsltPrincipalStylesheetDataPtr principalData;
1638 #endif
1639
1640
1641
1642 int forwards_compatible;
1643
1644 xmlHashTablePtr namedTemplates;
1645 };
1646
1647 typedef struct _xsltTransformCache xsltTransformCache;
1648 typedef xsltTransformCache *xsltTransformCachePtr;
1649 struct _xsltTransformCache {
1650 xmlDocPtr RVT;
1651 int nbRVT;
1652 xsltStackElemPtr stackItems;
1653 int nbStackItems;
1654 #ifdef XSLT_DEBUG_PROFILE_CACHE
1655 int dbgCachedRVTs;
1656 int dbgReusedRVTs;
1657 int dbgCachedVars;
1658 int dbgReusedVars;
1659 #endif
1660 };
1661
1662
1663
1664
1665 typedef enum {
1666 XSLT_OUTPUT_XML = 0,
1667 XSLT_OUTPUT_HTML,
1668 XSLT_OUTPUT_TEXT
1669 } xsltOutputType;
1670
1671 typedef enum {
1672 XSLT_STATE_OK = 0,
1673 XSLT_STATE_ERROR,
1674 XSLT_STATE_STOPPED
1675 } xsltTransformState;
1676
1677 struct _xsltTransformContext {
1678 xsltStylesheetPtr style;
1679 xsltOutputType type;
1680
1681 xsltTemplatePtr templ;
1682 int templNr;
1683 int templMax;
1684 xsltTemplatePtr *templTab;
1685
1686 xsltStackElemPtr vars;
1687 int varsNr;
1688 int varsMax;
1689 xsltStackElemPtr *varsTab;
1690 int varsBase;
1691
1692
1693
1694
1695 xmlHashTablePtr extFunctions;
1696 xmlHashTablePtr extElements;
1697 xmlHashTablePtr extInfos;
1698
1699 const xmlChar *mode;
1700 const xmlChar *modeURI;
1701
1702 xsltDocumentPtr docList;
1703
1704 xsltDocumentPtr document;
1705 xmlNodePtr node;
1706 xmlNodeSetPtr nodeList;
1707
1708
1709 xmlDocPtr output;
1710 xmlNodePtr insert;
1711
1712 xmlXPathContextPtr xpathCtxt;
1713 xsltTransformState state;
1714
1715
1716
1717
1718 xmlHashTablePtr globalVars;
1719
1720 xmlNodePtr inst;
1721
1722 int xinclude;
1723
1724 const char * outputFile;
1725
1726 int profile;
1727 long prof;
1728 int profNr;
1729 int profMax;
1730 long *profTab;
1731
1732 void *_private;
1733
1734 int extrasNr;
1735 int extrasMax;
1736 xsltRuntimeExtraPtr extras;
1737
1738 xsltDocumentPtr styleList;
1739 void * sec;
1740
1741 xmlGenericErrorFunc error;
1742 void * errctx;
1743
1744 xsltSortFunc sortfunc;
1745
1746
1747
1748
1749
1750 xmlDocPtr tmpRVT;
1751 xmlDocPtr persistRVT;
1752 int ctxtflags;
1753
1754
1755
1756
1757 const xmlChar *lasttext;
1758 int lasttsize;
1759 int lasttuse;
1760
1761
1762
1763 int debugStatus;
1764 unsigned long* traceCode;
1765
1766 int parserOptions;
1767
1768
1769
1770
1771 xmlDictPtr dict;
1772 xmlDocPtr tmpDoc;
1773
1774
1775
1776 int internalized;
1777 int nbKeys;
1778 int hasTemplKeyPatterns;
1779 xsltTemplatePtr currentTemplateRule;
1780 xmlNodePtr initialContextNode;
1781 xmlDocPtr initialContextDoc;
1782 xsltTransformCachePtr cache;
1783 void *contextVariable;
1784 xmlDocPtr localRVT;
1785
1786
1787 xmlDocPtr localRVTBase;
1788 int keyInitLevel;
1789 int depth;
1790 int maxTemplateDepth;
1791 int maxTemplateVars;
1792 };
1793
1794
1795
1796
1797
1798
1799
1800 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
1801
1802
1803
1804
1805
1806
1807
1808 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
1809
1810
1811
1812
1813
1814
1815
1816 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
1817
1818
1819
1820
1821
1822
1823
1824 #ifndef XML_CAST_FPTR
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838 #define XML_CAST_FPTR(fptr) fptr
1839 #endif
1840
1841
1842
1843
1844
1845 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1846 xsltNewStylesheet (void);
1847 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1848 xsltParseStylesheetFile (const xmlChar* filename);
1849 XSLTPUBFUN void XSLTCALL
1850 xsltFreeStylesheet (xsltStylesheetPtr style);
1851 XSLTPUBFUN int XSLTCALL
1852 xsltIsBlank (xmlChar *str);
1853 XSLTPUBFUN void XSLTCALL
1854 xsltFreeStackElemList (xsltStackElemPtr elem);
1855 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1856 xsltDecimalFormatGetByName(xsltStylesheetPtr style,
1857 xmlChar *name);
1858 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1859 xsltDecimalFormatGetByQName(xsltStylesheetPtr style,
1860 const xmlChar *nsUri,
1861 const xmlChar *name);
1862
1863 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1864 xsltParseStylesheetProcess(xsltStylesheetPtr ret,
1865 xmlDocPtr doc);
1866 XSLTPUBFUN void XSLTCALL
1867 xsltParseStylesheetOutput(xsltStylesheetPtr style,
1868 xmlNodePtr cur);
1869 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1870 xsltParseStylesheetDoc (xmlDocPtr doc);
1871 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1872 xsltParseStylesheetImportedDoc(xmlDocPtr doc,
1873 xsltStylesheetPtr style);
1874 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1875 xsltLoadStylesheetPI (xmlDocPtr doc);
1876 XSLTPUBFUN void XSLTCALL
1877 xsltNumberFormat (xsltTransformContextPtr ctxt,
1878 xsltNumberDataPtr data,
1879 xmlNodePtr node);
1880 XSLTPUBFUN xmlXPathError XSLTCALL
1881 xsltFormatNumberConversion(xsltDecimalFormatPtr self,
1882 xmlChar *format,
1883 double number,
1884 xmlChar **result);
1885
1886 XSLTPUBFUN void XSLTCALL
1887 xsltParseTemplateContent(xsltStylesheetPtr style,
1888 xmlNodePtr templ);
1889 XSLTPUBFUN int XSLTCALL
1890 xsltAllocateExtra (xsltStylesheetPtr style);
1891 XSLTPUBFUN int XSLTCALL
1892 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt);
1893
1894
1895
1896 XSLTPUBFUN xmlDocPtr XSLTCALL
1897 xsltCreateRVT (xsltTransformContextPtr ctxt);
1898 XSLTPUBFUN int XSLTCALL
1899 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt,
1900 xmlDocPtr RVT);
1901 XSLTPUBFUN int XSLTCALL
1902 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt,
1903 xmlDocPtr RVT);
1904 XSLTPUBFUN int XSLTCALL
1905 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt,
1906 xmlDocPtr RVT);
1907 XSLTPUBFUN int XSLTCALL
1908 xsltExtensionInstructionResultRegister(
1909 xsltTransformContextPtr ctxt,
1910 xmlXPathObjectPtr obj);
1911 XSLTPUBFUN int XSLTCALL
1912 xsltExtensionInstructionResultFinalize(
1913 xsltTransformContextPtr ctxt);
1914 XSLTPUBFUN int XSLTCALL
1915 xsltFlagRVTs(
1916 xsltTransformContextPtr ctxt,
1917 xmlXPathObjectPtr obj,
1918 void *val);
1919 XSLTPUBFUN void XSLTCALL
1920 xsltFreeRVTs (xsltTransformContextPtr ctxt);
1921 XSLTPUBFUN void XSLTCALL
1922 xsltReleaseRVT (xsltTransformContextPtr ctxt,
1923 xmlDocPtr RVT);
1924
1925
1926
1927 XSLTPUBFUN void XSLTCALL
1928 xsltCompileAttr (xsltStylesheetPtr style,
1929 xmlAttrPtr attr);
1930 XSLTPUBFUN xmlChar * XSLTCALL
1931 xsltEvalAVT (xsltTransformContextPtr ctxt,
1932 void *avt,
1933 xmlNodePtr node);
1934 XSLTPUBFUN void XSLTCALL
1935 xsltFreeAVTList (void *avt);
1936
1937
1938
1939
1940
1941 XSLTPUBFUN void XSLTCALL
1942 xsltUninit (void);
1943
1944
1945
1946
1947
1948
1949
1950 #ifdef XSLT_REFACTORED
1951 XSLTPUBFUN void XSLTCALL
1952 xsltParseSequenceConstructor(
1953 xsltCompilerCtxtPtr cctxt,
1954 xmlNodePtr start);
1955 XSLTPUBFUN int XSLTCALL
1956 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt,
1957 xmlNodePtr elem);
1958 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1959 XSLTPUBFUN int XSLTCALL
1960 xsltRestoreDocumentNamespaces(
1961 xsltNsMapPtr ns,
1962 xmlDocPtr doc);
1963 #endif
1964 #endif
1965
1966
1967
1968
1969
1970
1971 XSLTPUBFUN int XSLTCALL
1972 xsltInitCtxtKey (xsltTransformContextPtr ctxt,
1973 xsltDocumentPtr doc,
1974 xsltKeyDefPtr keyd);
1975 XSLTPUBFUN int XSLTCALL
1976 xsltInitAllDocKeys (xsltTransformContextPtr ctxt);
1977 #ifdef __cplusplus
1978 }
1979 #endif
1980
1981 #endif
1982