node.xsl (n:attr#1): added
parent
057cdbb683
commit
2967463cdb
10
src/node.xsl
10
src/node.xsl
|
@ -156,6 +156,16 @@
|
|||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Construct an attribute named @var{qname} with an empty value.
|
||||
-->
|
||||
<function name="n:attr" as="attribute()">
|
||||
<param name="qname" as="xs:QName" />
|
||||
|
||||
<sequence select="n:attr( $qname, '' )" />
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Create a text node with the given @var{text}. The @var{text} will be
|
||||
output verbatim without any whitespace processing.
|
||||
|
|
|
@ -172,19 +172,36 @@
|
|||
|
||||
|
||||
<scenario label="A new attribute">
|
||||
<!-- to test this, the attribute needs an element parent -->
|
||||
<call function="n:element">
|
||||
<param name="qname" select="$test-qname-a" />
|
||||
<param name="attrs"
|
||||
select="n:attr( $test-qname-b, 'foo' )" />
|
||||
<param name="child-nodes" select="()" />
|
||||
</call>
|
||||
<scenario label="with a value">
|
||||
<!-- to test this, the attribute needs an element parent -->
|
||||
<call function="n:element">
|
||||
<param name="qname" select="$test-qname-a" />
|
||||
<param name="attrs"
|
||||
select="n:attr( $test-qname-b, 'foo' )" />
|
||||
</call>
|
||||
|
||||
<expect label="has given QName"
|
||||
test="node-name( $x:result/@* ) = $test-qname-b" />
|
||||
<expect label="has given QName"
|
||||
test="node-name( $x:result/@* ) = $test-qname-b" />
|
||||
|
||||
<expect label="has given value"
|
||||
test="$x:result/@* = 'foo'" />
|
||||
<expect label="has given value"
|
||||
test="$x:result/@* = 'foo'" />
|
||||
</scenario>
|
||||
|
||||
|
||||
<scenario label="with no value">
|
||||
<!-- to test this, the attribute needs an element parent -->
|
||||
<call function="n:element">
|
||||
<param name="qname" select="$test-qname-a" />
|
||||
<param name="attrs"
|
||||
select="n:attr( $test-qname-c )" />
|
||||
</call>
|
||||
|
||||
<expect label="has given QName"
|
||||
test="node-name( $x:result/@* ) = $test-qname-c" />
|
||||
|
||||
<expect label="has empty value"
|
||||
test="$x:result/@* = ''" />
|
||||
</scenario>
|
||||
</scenario>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue