view release on metacpan or search on metacpan
0.02 June 4, 2002
- fixed AVT attributes
- complete matching (visible, global)
- added STXPath functions: position, get-node, level,
concat, translate, not
0.01 May 31, 2002
- original version; created by h2xs 1.20
- stx:transform (@version)
- stx:options (@strip-space, @no-match-events,
@default-stxpath-namespace, @recognize-cdata)
- stx:template (@match, @priority)
- literal elements: full (including AVT in attributes)
- literal text (in templates)
- stx:process-children: without 'mode'
- stx:value-of (@select)
- stx:copy (@attributes): elements, text, cdata,
processing-instructions, comments
- stx:element (@name, @namespace)
- stx:element-start (@name, @namespace)
- stx:element-end (@name, @namespace)
- stx:attribute (@name, @namespace, @select)
- stx:text, stx:cdata
- stx:comment, stx:processing-instruction
- matching: the 1st precedence category
(the same group + public/global templates from childrens)
- STXPath: no variables, limited set of functions
- STXPath functions: true, false, boolean, string, number,
name, namespace, local-name, prefix, normalize-space
test/attribute.stx
test/buffers01.stx
test/buffers-clear.stx
test/buffers-group.stx
test/buffers-local.stx
test/buffers-recursive.stx
test/call-procedure.stx
test/call-procedure2.stx
test/call-procedure3.stx
test/call-procedure4.stx
test/cdata-group1.stx
test/cdata-group2.stx
test/cdata-no.stx
test/cdata-out.stx
test/cdata.stx
test/cdata-yes.stx
test/choose.stx
test/comment.stx
test/copy.stx
test/default-copy.stx
test/default-group1.stx
test/default-group2.stx
test/default-ignore.stx
test/default-stxpath-ns.stx
test/default-stxpath-ns2.stx
test/default-text.stx
STX/Base.pm view on Meta::CPAN
sub I_RES_DOC_START(){120;}
sub I_RES_DOC_END(){121;}
sub I_FOR_EACH_ITEM(){122};
sub I_WHILE(){123};
# tokens
$NCName = '[A-Za-z_][\w\\.\\-]*';
$QName = "($NCName:)?$NCName";
$NCWild = "${NCName}:\\*|\\*:${NCName}";
$QNWild = "\\*";
$NODE_TYPE = '((text|comment|processing-instruction|node|cdata)\\(\\))';
$NUMBER_RE = '\d+(\\.\d*)?|\\.\d+';
$DOUBLE_RE = '\d+(\\.\d*)?[eE][+-]?\d+';
$LITERAL = '\\"[^\\"]*\\"|\\\'[^\\\']*\\\'';
$URIREF = '[a-z][\w\;\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\'\(\)\%]+';
# --------------------------------------------------
# error processing
# --------------------------------------------------
sub doError {
STX/Base.pm view on Meta::CPAN
elsif ($seq->[0]->[1] == STX_NUMBER) {$type = 'number'}
elsif ($seq->[0]->[1] == STX_NODE) {
$type = 'node';
if ($seq->[0]->[0]->{Type} == STX_ELEMENT_NODE) {
$type .= '-element';
} elsif ($seq->[0]->[0]->{Type} == STX_ATTRIBUTE_NODE) {
$type .= '-attribute';
} elsif ($seq->[0]->[0]->{Type} == STX_TEXT_NODE) {
$type .= '-text';
} elsif ($seq->[0]->[0]->{Type} == STX_CDATA_NODE) {
$type .= '-cdata';
} elsif ($seq->[0]->[0]->{Type} == STX_PI_NODE) {
$type .= '-processing-instruction';
} elsif ($seq->[0]->[0]->{Type} == STX_COMMENT_NODE) {
$type .= '-comment';
} else {
$type .= '-root';
}
}
} else {
$type = 'empty sequence';
}
return $type;
}
sub _counter_key($) {
my ($self, $tok) = @_;
$tok =~ s/^node\(\)$/\/node/
or $tok =~ s/^text\(\)$/\/text/
or $tok =~ s/^cdata\(\)$/\/cdata/
or $tok =~ s/^comment\(\)$/\/comment/
or $tok =~ s/^processing-instruction\(\)$/\/pi/
or $tok =~ s/^processing-instruction:(.*)$/\/pi:$1/
or $tok = index($tok, ':') > 0 ? $tok : ':' . $tok;
$tok =~ s/\*/\/star/;
return $tok;
}
sub _to_sequence {
STX/Buffer.pm view on Meta::CPAN
push @{$self->{events}}, [$method, $char];
}
sub processing_instruction {
my ($self, $pi) = @_;
my $method = $self->{stx}->can('processing_instruction');
push @{$self->{events}}, [$method, $pi];
}
sub start_cdata {
my $self = shift;
my $method = $self->{stx}->can('start_cdata');
push @{$self->{events}}, [$method, undef];
}
sub end_cdata {
my $self = shift;
my $method = $self->{stx}->can('end_cdata');
push @{$self->{events}}, [$method, undef];
}
sub comment {
my ($self, $com) = @_;
my $method = $self->{stx}->can('comment');
push @{$self->{events}}, [$method, $com];
}
STX/Functions.pm view on Meta::CPAN
if ($seq->[0] and $seq->[0]->[1] == STX_NODE) {
if ($seq->[0]->[0]->{Type} == 1) {
return [['element' ,STX_STRING]];
} elsif ($seq->[0]->[0]->{Type} == 2) {
return [['text' ,STX_STRING]];
} elsif ($seq->[0]->[0]->{Type} == 3) {
return [['cdata' ,STX_STRING]];
} elsif ($seq->[0]->[0]->{Type} == 4) {
return [['processing-instruction' ,STX_STRING]];
} elsif ($seq->[0]->[0]->{Type} == 5) {
return [['comment' ,STX_STRING]];
} elsif ($seq->[0]->[0]->{Type} == 6) {
return [['attribute' ,STX_STRING]];
STX/Parser.pm view on Meta::CPAN
$self->{Sheet}->{Options}->{'output-encoding'}
= $a->{'{}output-encoding'}->{Value};
} else {
$self->doError(217, 3, 'output-encoding',
$a->{'{}output-encoding'}->{Value},
'string');
}
}
}
# options: recognize-cdata
if (exists $a->{'{}recognize-cdata'}) {
if ($a->{'{}recognize-cdata'}->{Value} eq 'no') {
$self->{g_stack}->[-1]->{Options}->{'recognize-cdata'} = 0
} elsif ($a->{'{}recognize-cdata'}->{Value} ne 'yes') {
$self->doError(205, 3, 'recognize-data',
$a->{'{}recognize-cdata'}->{Value});
}
}
# options: pass-through
if (exists $a->{'{}pass-through'}) {
if ($a->{'{}pass-through'}->{Value} eq 'all') {
$self->{g_stack}->[-1]->{Options}->{'pass-through'} = 1
} elsif ($a->{'{}pass-through'}->{Value} eq 'text') {
$self->{g_stack}->[-1]->{Options}->{'pass-through'} = 2
STX/Parser.pm view on Meta::CPAN
$g->{name} = $a->{'{}name'}->{Value};
$g->{name} = $self->_expand_qname($g->{name});
$self->doError(219, 3, 'group', $g->{name})
if exists $self->{Sheet}->{named_groups}->{$g->{name}};
$self->{Sheet}->{named_groups}->{$g->{name}} = $g;
}
# options: recognize-cdata
if (exists $a->{'{}recognize-cdata'}) {
if ($a->{'{}recognize-cdata'}->{Value} eq 'no') {
$g->{Options}->{'recognize-cdata'} = 0
} elsif ($a->{'{}recognize-cdata'}->{Value} eq 'yes') {
$g->{Options}->{'recognize-cdata'} = 1
} elsif ($a->{'{}recognize-cdata'}->{Value} eq 'inherit') {
$g->{Options}->{'recognize-cdata'}
= $g->{group}->{Options}->{'recognize-cdata'}
} else {
$self->doError(205, 3, 'recognize-data',
$a->{'{}recognize-cdata'}->{Value});
}
} else {
$g->{Options}->{'recognize-cdata'}
= $g->{group}->{Options}->{'recognize-cdata'}
}
# options: pass-through
if (exists $a->{'{}pass-through'}) {
if ($a->{'{}pass-through'}->{Value} eq 'all') {
$g->{Options}->{'pass-through'} = 1
} elsif ($a->{'{}pass-through'}->{Value} eq 'text') {
$g->{Options}->{'pass-through'} = 2
STX/Parser.pm view on Meta::CPAN
push @{$self->{c_template}->[-1]->{instructions}},
[I_ATTRIBUTE_START, $qn, $ns, clone($self->{nsc}), $sel];
#print "COMP: >ATTRIBUTE_START\n";
}
# <stx:text> ----------------------------------------
} elsif ($el->{LocalName} eq 'text') {
$self->_allowed($el->{LocalName});
# <stx:cdata> ----------------------------------------
} elsif ($el->{LocalName} eq 'cdata') {
if ($self->_allowed($el->{LocalName})) {
push @{$self->{c_template}->[-1]->{instructions}},
[I_CDATA_START];
#print "COMP: >CDATA_START\n";
}
# <stx:comment> ----------------------------------------
} elsif ($el->{LocalName} eq'comment') {
STX/Parser.pm view on Meta::CPAN
push @{$self->{c_template}->[-1]->{instructions}}, [I_ELEMENT_END];
#print "COMP: >ELEMENT_END /$el->{Name}\n";
# <stx:attribute> ----------------------------------------
} elsif ($el->{LocalName} eq 'attribute') {
push @{$self->{c_template}->[-1]->{instructions}}, [I_ATTRIBUTE_END];
#print "COMP: >ATTRIBUTE_END\n";
# <stx:cdata> ----------------------------------------
} elsif ($el->{LocalName} eq 'cdata') {
push @{$self->{c_template}->[-1]->{instructions}}, [I_CDATA_END];
#print "COMP: >CDATA_END\n";
# <stx:comment> ----------------------------------------
} elsif ($el->{LocalName} eq 'comment') {
push @{$self->{c_template}->[-1]->{instructions}}, [I_COMMENT_END];
#print "COMP: >COMMENT_END\n";
STX/Parser.pm view on Meta::CPAN
}
sub characters {
my $self = shift;
my $char = shift;
# whitespace only
if ($char->{Data} =~ /^\s*$/) {
my $parent = $self->{e_stack}->[-1];
if ($parent->{NamespaceURI} eq STX_NS_URI
and $parent->{LocalName} =~ /^(text|cdata)$/) {
if ($self->_allowed('_text')) {
push @{$self->{c_template}->[-1]->{instructions}},
[I_CHARACTERS, $char->{Data}];
#print "COMP: >CHARACTERS - $char->{Data}\n";
}
}
# not whitespace only
} else {
STX/Parser.pm view on Meta::CPAN
my ($self, $ns) = @_;
$self->{nsc}->undeclare_prefix($ns->{Prefix});
}
sub skipped_entity {
}
# lexical ----------------------------------------
sub start_cdata {
my $self = shift;
}
sub end_cdata {
my $self = shift;
}
sub comment {
}
sub start_dtd {
}
sub end_dtd {
STX/Parser.pm view on Meta::CPAN
my $p = 0.5;
if ($#steps == 0) {
if ($last =~ /^$QName$/) {
$p = 0;
} elsif ($last =~ /^processing-instruction\(?:$LITERAL\)$/) {
$p = 0;
} elsif ($last =~ /^cdata\(\)$/) {
$p = 0;
} elsif ($last =~ /^(?:$NCWild)$/) {
$p = -0.25;
} elsif ($last =~ /^(?:$QNWild)$/) {
$p = -0.25;
} elsif ($last =~ /^$NODE_TYPE$/) {
$p = -0.5;
STX/Parser.pm view on Meta::CPAN
return \@tokens;
}
# structure ----------------------------------------
my $s_group = ['variable','buffer','template','procedure','include','group'];
my $s_top_level = [@$s_group, 'param', 'namespace-alias'];
my $s_text_constr = ['text','cdata','value-of','if','else','choose','_text'];
my $s_content_constr = [@$s_text_constr ,'call-procedure', 'copy',
'process-attributes', 'process-self', 'element',
'start-element', 'end-element', 'comment',
'processing-instruction', 'variable', 'param',
'assign', 'buffer', 'result-buffer', 'process-buffer',
'result-document', 'process-document', 'for-each-item',
'while', '_literal', 'attribute'];
my $s_template = [@$s_content_constr, 'process-children', 'process-siblings'];
STX/Parser.pm view on Meta::CPAN
'if' => $s_template,
'else' => $s_template,
choose => ['when','otherwise'],
when => $s_template,
otherwise => $s_template,
'for-each-item' => $s_template,
while => $s_template,
variable => $s_text_constr,
assign => $s_text_constr,
text => ['_text'],
cdata => ['_text'],
buffer => $s_template,
'result-buffer' => $s_template,
'result-document' => $s_template,
_literal => $s_template,
};
sub _allowed {
my ($self, $lname) = @_;
if ($#{$self->{e_stack}} == -1) {
STX/Runtime.pm view on Meta::CPAN
my ($self, $map) = @_;
$self->_current_node([STXE_END_PREF, $map]);
}
sub skipped_entity {
}
# lexical ----------------------------------------
sub start_cdata {
my $self = shift;
#print "STX: start_cdata\n";
if ($self->_get_base_group()->{Options}->{'recognize-cdata'}) {
$self->_current_node([STXE_START_CDATA]);
$self->{CDATA} = 1;
}
}
sub end_cdata {
my $self = shift;
#print "STX: end_cdata\n";
if ($self->_get_base_group()->{Options}->{'recognize-cdata'}) {
$self->_current_node([STXE_END_CDATA]);
$self->{CDATA} = 0;
}
}
sub comment {
my $self = shift;
my $comment = shift;
#print "STX: comment: $comment->{Data}\n";
STX/Runtime.pm view on Meta::CPAN
my $char = shift;
#print "STX: > _characters: $char->{Data}\n";
return if $self->_get_base_group()->{Options}->{'strip-space'}
and $char->{Data} =~ /^\s*$/;
my $index = scalar @{$self->{Stack}};
#$self->{Counter}->[$index] or $self->{Counter}->[$index] = {};
$self->_counter($index, '/node', '/text');
$self->_counter($index, '/cdata') if $self->{CDATA};
$char->{Index} = $index;
$char->{Counter} = $self->{Counter}->[$index];
push @{$self->{Stack}}, $char;
push @{$self->{LookUp}}, 0;
$self->_process;
pop @{$self->{LookUp}};
STX/Runtime.pm view on Meta::CPAN
}
} elsif ($type == STX_TEXT_NODE) {
$out = $self->_send_element_start($out) if exists $out->{Name};
$self->_send_text($c_node->{Data});
} elsif ($type == STX_CDATA_NODE) {
$out = $self->_send_element_start($out) if exists $out->{Name};
$self->SUPER::start_cdata() unless $self->{_TTO};
$self->_send_text($c_node->{Data});
$self->SUPER::end_cdata() unless $self->{_TTO};
} elsif ($type == STX_PI_NODE) {
$out = $self->_send_element_start($out) if exists $out->{Name};
$self->SUPER::processing_instruction(
{Target => $c_node->{Target},
Data => $c_node->{Data}});
} elsif ($type == STX_COMMENT_NODE) {
$out = $self->_send_element_start($out) if exists $out->{Name};
STX/Runtime.pm view on Meta::CPAN
$out = $self->_send_element_start($out) if exists $out->{Name};
$out = $self->_send_element_end($c_node);
}
# else: ignore </copy> for other types of nodes
# I_CDATA_START ----------------------------------------
} elsif ($i->[0] == I_CDATA_START) {
$out = $self->_send_element_start($out) if exists $out->{Name};
$self->SUPER::start_cdata();
# I_CDATA_END ----------------------------------------
} elsif ($i->[0] == I_CDATA_END) {
$self->SUPER::end_cdata();
# I_COMMENT_START ----------------------------------------
} elsif ($i->[0] == I_COMMENT_START) {
$out = $self->_send_element_start($out) if exists $out->{Name};
$self->{_TTO} = 'COM'; # comment
$self->{_text_cache} = '';
# I_COMMENT_END ----------------------------------------
} elsif ($i->[0] == I_COMMENT_END) {
STX/Runtime.pm view on Meta::CPAN
foreach (@{$self->{Stack}}) {
if ($_->{Type} == STX_ELEMENT_NODE) {
print "/", $_->{Name};
} elsif ($_->{Type} == STX_TEXT_NODE) {
my $norm = $_->{Data};
$norm =~ s/\s+/ /g;
print "/[text]$norm";
} elsif ($_->{Type} == STX_CDATA_NODE) {
my $norm = $_->{Data};
$norm =~ s/\s+/ /g;
print "/[cdata]$norm";
} elsif ($_->{Type} == STX_COMMENT_NODE) {
my $norm = $_->{Data};
$norm =~ s/\s+/ /g;
print "/[comment]$norm";
} elsif ($_->{Type} == STX_PI_NODE) {
my $norm = $_->{Target};
$norm =~ s/\s+/ /g;
print "/[pi]$norm";
} elsif ($_->{Type} == STX_ROOT_NODE) {
print "^";
STX/STXPath.pm view on Meta::CPAN
my ($self, $node) = @_;
#print "EXP: kindTest ", $self->{tokens}->[0], ", $node->{Type}\n";
my $test = $self->{tokens}->[0];
if ($test eq 'node()') {
return 1;
} elsif ($test eq 'text()') {
return 1 if $node->{Type} == 2 or $node->{Type} == 3;
} elsif ($test eq 'cdata()') {
return 1 if $node->{Type} == 3;
} elsif ($test eq 'processing-instruction()') {
return 1 if $node->{Type} == 4;
} elsif ($test eq 'processing-instruction') {
unless ($self->{tokens}->[1] eq '('
and $self->{tokens}->[2] =~ /^(?:$LITERAL)$/o
and $self->{tokens}->[3] eq ')') {
STX/Stylesheet.pm view on Meta::CPAN
}
# --------------------------------------------------
package XML::STX::Group;
sub new {
my ($class, $gid, $group) = @_;
my $options = {'pass-through' => 0,
'recognize-cdata' => 1,
'strip-space' => 0,
};
my $self = bless {
Options => $options,
gid => $gid,
group => $group, # parent group
templates => {}, # contained templates
vGroup => [], # group templates for non attributes
vGroupA => [], # group templates for attributes
STX/Writer.pm view on Meta::CPAN
$self->{_start_prefmap}->{$map->{Prefix}} = $map->{NamespaceURI};
}
sub end_prefix_mapping {
my ($self, $map) = @_;
}
# lexical --------------------------------------------------
sub start_cdata {
my $self = shift;
local *STDOUT = $self->{RES} if exists $self->{RES};
$self->{CDATA} = 1;
print '<![CDATA[';
}
sub end_cdata {
my $self = shift;
local *STDOUT = $self->{RES} if exists $self->{RES};
$self->{CDATA} = 0;
print ']]>';
}
sub comment {
my ($self, $comment) = @_;
}
sub _groupProperties {
my ($g, $label) = @_;
$list->append('', '');
$list->append($label, '');
$list->append('- pass-through:',
$pass_through->{$g->{Options}->{'pass-through'}});
$list->append('- recognize-cdata:',
$yn->{$g->{Options}->{'recognize-cdata'}});
$list->append('- strip-space:',
$yn->{$g->{Options}->{'strip-space'}});
$list->append('', '');
$list->append('Visible templates', '');
my @pc1 = sort {$a <=> $b} map($_->{tid}, @{$g->{pc1}}, @{$g->{pc1A}});
$list->append('- precedence category 1:', join(',', @pc1));
my @pc2 = sort {$a <=> $b} map($_->{tid}, @{$g->{pc2}}, @{$g->{pc2A}});
$list->append('- precedence category 2:', join(',', @pc2));
test/TestHandler.pm view on Meta::CPAN
$self->{_start_prefmap}->{$map->{Prefix}} = $map->{NamespaceURI};
}
sub end_prefix_mapping {
my ($self, $map) = @_;
}
# lexical --------------------------------------------------
sub start_cdata {
my $self = shift;
$self->{result} .= "<![CDATA[";
}
sub end_cdata {
my $self = shift;
$self->{result} .= "]]>";
}
sub comment {
my ($self, $comment) = @_;
$self->{result} .= "<!-- $comment->{Data} -->";
}
test/_data01.xml view on Meta::CPAN
<?xml version="1.0"?>
<root>
<node id="1">koko</node>
<node id="2">mato</node>
<!-- other node types -->
text1
<![CDATA[<<cdata-text>>]]>
text2
<?pi pi-content?>
<node a1="A" a0="B" a3="C"/>
</root>
test/_index view on Meta::CPAN
# options --------------------
default-ignore|01|0|OK
default-text|02|0|<root >koko text<![CDATA[<&>]]></root>
default-copy|02|0|<root ><node id="1" >koko</node><!-- comment --> text<![CDATA[<&>]]><?pi pi-content?></root>
default-group1|01|0|[<node ></node>] [<node ></node>] [<node ></node>]
default-group2|01|0|[<node ></node>] [<node ></node>] [<node ></node>]
default-stxpath-ns|03|0|OK
default-stxpath-ns2|04|0|OK
stxpath-ns|04|0|OK
cdata|01|0|[<![CDATA[<<cdata-text>>]]>]
cdata-yes|01|0|[ text1] [<![CDATA[<<cdata-text>>]]>] [ text2]
cdata-no|01|0|[ text1<<cdata-text>> text2]
cdata-group1|01|0|[ text1] [<![CDATA[<<cdata-text>>]]>] [ text2]
cdata-group2|01|0|[ text1] [<![CDATA[<<cdata-text>>]]>] [ text2]
strip-space1|01|0|[koko] [mato] [ text1] [<![CDATA[<<cdata-text>>]]>] [ text2]
strip-space2|01|0|[koko] [mato] [ text1] [<![CDATA[<<cdata-text>>]]>] [ text2]
strip-space3|01|0|[koko] [mato] [ text1] [<![CDATA[<<cdata-text>>]]>] [ text2]
# matching & groups --------------------
template-match1|01|0|root-3node-2node-1node-2
template-match2|01|0|root-3node-2node-2node-2
template-match3|01|0|OK
template-match4|01|0|OK2OK3OK1
template-match-position|01|0|<el >root<el >node</el><id >2</id><node > text1</node><cdata ><![CDATA[<<cdata-text>>]]></cdata><text > text2</text></el>
template-lookup|01|0|root-3
process-attributes|01|0|<n ><id >1</id></n><n ><id >2</id></n><n ><a0 >B</a0><a1 >A</a1><a3 >C</a3></n>
process-self|01|0|<a ><b ><c >OK</c></b></a>
process-combined|01|0|<n >koko(koko){1}[koko]</n><n >mato(mato){2}[mato]</n><n >{B}{A}{C}[]</n>
groups|01|0|root.1 node.1 node.2 node.3
groups-named|01|0|root.1 node.1 koko node.2 mato <<cdata-text>> node.3
groups-named-att|01|0|/1 @id {koko} $id/2 @id {mato} $id/3 @a0 @a1 @a3 $a0 $a1 $a3
namespaces01|04|0|<root xmlns="http://koko" ><test:node id="1" xmlns:test="http://test_ns" >1</test:node></root>
process-siblings1|01|0|<a ><n ><s >2</s><s >3</s></n></a>
process-siblings2|01|0|<a ><n ><s >2</s></n><s >3</s></a>
process-siblings3|01|0|<a ><n ><s >2</s></n><s >3</s></a>
# flow control --------------------
if|01|0|<root >n:tT:Nn:t2text(mato)T:Nn::N</root>
else|01|0|<root >1[2]OK[]3</root>
test/_index view on Meta::CPAN
for-each-item1|01|0|<root ><i >abckoko</i><i >abcmato</i><i >abc</i></root>
for-each-item2|01|0|<root ><i ><j >1a0</j><j >1b0</j></i><i ><j >2a0</j><j >2b0</j></i><i ><j >3a0</j><j >3b0</j></i></root>
while1|01|0|<root >0123456789</root>
while2|01|0|<root ><w >0<i >a1</i><i >b2</i></w><w >2<i >a3</i><i >b4</i></w><w >4<i >a5</i><i >b6</i></w></root>
while3|01|0|<root ><w >0-1M</w><w >1-2M</w><w >2-3M</w><w >3-4M</w><w >4-5M</w><w >5-6M</w></root>
while4|01|0|<root ><w >0-1M</w></root>
# output --------------------
text|01|0|A B C D
cdata-out|01|0|<![CDATA[&]]>&
literal|01|0|<element name="node" >literal text</element>
literal-avt|01|0|<r att-node="1" avt="1+2" ><lit a1="3" a2="1+2=3" a3="a2/b1" ></lit></r>
copy|02|0|<root ><node id="1" >koko</node><!-- comment --> text<![CDATA[<&>]]><?pi pi-content?></root>
value-of|01|0|<root >text:52 2:5:true:Hi there:a-2-b:a2b</root>
value-of-att|01|0|1(1)2(1)AC(3)
value-of-path|01|0|<root >koko:koko:koko:koko:koko:tek:1:1:1:1</root>
element|01|0|<node ><p:el xmlns:p="NS1" ><g0:el xmlns:g0="NS2" ></g0:el></p:el></node>
element2|03|0|<root ><node ></node></root>
element-separate|01|0|<node ><p:el xmlns:p="NS1" ></p:el></node>
attribute|01|0|<node g0:node="9koko" a1="4" xmlns:g0="NS" ></node>
comment|01|0|T1<!-- Comment Text:2 -->T2T3
processing-instruction|01|0|T1<?node PI-text?>T2
string-value1|01|0| other node types text1 <<cdata-text>> text2 pi-content
string-value2|01|0|koko/1|/mato/2|//B|A|C|/
string-value3|03|0|<root >--:koko</root>
namespace-alias|01|0|<stx:r xmlns:stx="http://stx.sourceforge.net/2002/ns" ><p2:n xmlns:p2="ns:p2" ></p2:n><p1:n stx:a1="c" a2="d" xmlns:p1="ns:p1" ></p1:n></stx:r>
# STXPath --------------------
node-test-text|01|0|<root >mato:mato::</root>
funct-qname|01|0|<n >1:1:1:1</n><n >2:2:2:2</n><n >3:3:3:3</n>
stxpath-bool|03|0|<node >false-true-false-true-false</node>
stxpath-position|01|0|<root >p:1<node >p:1</node><node>p:2</node><node >p:3</node></root>
test/_index view on Meta::CPAN
stxpath-count|01|0|<node >3:3-5:5-1:1-0:0</node>
stxpath-empty|01|0|<node >false:false-true:true</node>
stxpath-exists|01|0|<node >true:true-false:false</node>
stxpath-item-at|01|0|<node >b:b-mato:</node>
stxpath-index-of|01|0|<node >3::2 5:1 4[2][1][]</node>
stxpath-subsequence|01|0|<node >5;3:c-e 5;2:b-c</node>
stxpath-insert-before|01|0|<node >z a b c:z a b c:a z b c:a b z c:a b c z/a b c:z/z:a b c/z a b c:a b c z</node>
stxpath-remove|01|0|<node >a b c:b c:a c:a b:a b c/a b c//a b c:a b c</node>
stxpath-case|01|0|<root >ABCD0-abcd0</root>
stxpath-string-pad|01|0|<root >XMLQueryXMLQuery-aaaa-</root>
stxpath-node-kind|01|0|<document nm="" ><element nm="root" ><element nm="node" ><text nm="" ></text></element><element nm="node" ><text nm="" ></text></element><comment nm="" ></comment><text nm="" ></text><cdata nm="" ></cdata><text nm="" ></text><p...
stxpath-normalize-space|01|0|<root >ko:koko:ko ko ma:koko</root>
stxpath-aggregate|01|0|<node >9.8:0/2.45:/-1:1/5:100</node>
stxpath-numeric|01|0|<node >3:2:-2/10:-11/11:-10</node>
stxpath-get-in-scope-prefs|03|0|<root >*foo*xml*xmlns<node >*foo*xml*xmlns</node></root>
stxpath-get-namespace-for-pref|03|0|<root >http://test_ns*http://test_ns2<node >http://test_ns*http://test_ns2</node></root>
# variables & parameters --------------------
variable-local|01|0|<root >5:<text >name is root</text></root>
variable-group-01|01|0|<root >9<node >123:2</node></root>
test/cdata-group1.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
recognize-cdata="no"
strip-space="yes">
<stx:group recognize-cdata="yes">
<stx:template match="root" public="yes">
<stx:process-children/>
</stx:template>
<stx:template match="text()[name(..)='root']">
[<stx:copy/>]
</stx:template>
</stx:group>
test/cdata-group2.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
recognize-cdata="no"
strip-space="yes">
<stx:template match="root">
<stx:process-children group="g1"/>
</stx:template>
<stx:group name="g1" recognize-cdata="yes">
<stx:template match="text()[name(..)='root']">
[<stx:copy/>]
</stx:template>
</stx:group>
</stx:transform>
test/cdata-no.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
recognize-cdata="no"
strip-space="yes">
<stx:template match="text()[name(..)='root']">
[<stx:copy/>]
</stx:template>
</stx:transform>
test/cdata-out.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
strip-space="yes"
recognize-cdata="yes">
<stx:template match="node[@id=2]">
<stx:cdata><![CDATA[&]]></stx:cdata>
<stx:text><![CDATA[&]]></stx:text>
</stx:template>
</stx:transform>
test/cdata.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
strip-space="yes"
recognize-cdata="yes">
<stx:template match="cdata()">
[<stx:copy/>]
</stx:template>
</stx:transform>
test/groups-named.stx view on Meta::CPAN
<stx:group name="g1">
<stx:template match="node">
<stx:text> </stx:text>
<stx:value-of select="name()"/>
<stx:text>.</stx:text>
<stx:value-of select="position()"/>
<stx:process-children group="g2"/>
</stx:template>
<stx:template match="cdata()">
<stx:text> </stx:text>
<stx:value-of select="."/>
</stx:template>
</stx:group>
<stx:group name="g2">
<stx:template match="node">
<stx:text> </stx:text>
test/string-value1.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
strip-space="yes">
<stx:template match="/root">
<stx:process-children/>
</stx:template>
<stx:template match="cdata()|text()|comment()|processing-instruction()">
<stx:value-of select="."/>
</stx:template>
<stx:template match="*"/>
</stx:transform>
test/string-value2.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
strip-space="yes">
<stx:template match="/root">
<stx:process-children/>
</stx:template>
<stx:template match="cdata()|text()|comment()|processing-instruction()"/>
<stx:template match="*">
<stx:value-of select="."/>
<stx:text>/</stx:text>
<stx:process-attributes/>
<stx:text>/</stx:text>
</stx:template>
<stx:template match="@*">
test/template-match-position.stx view on Meta::CPAN
<stx:process-children/>
</el>
</stx:template>
<stx:template match="node()[position()=4]">
<node>
<stx:copy/>
</node>
</stx:template>
<stx:template match="cdata()[position()=1]">
<cdata>
<stx:copy/>
</cdata>
</stx:template>
<stx:template match="text()[3]">
<text>
<stx:copy/>
</text>
</stx:template>
</stx:transform>
test/text.stx view on Meta::CPAN
<stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns"
strip-space="yes"
recognize-cdata="yes">
<stx:template match="node[@id=2]">
<stx:text>A B C</stx:text>
<stx:text> D</stx:text>
</stx:template>
</stx:transform>