Token
Attributes
| URI: | http://www.xml.org/pipe/xpe/filter/token |
| Type: | filter |
| Namespace: | http://www.xml.org/xpe/token |
| Owner: | http://www.xmlpipe.org/xpe |
Description
This filter generates unique token(s). The filter reacts to the following XML fragment:
<t:token
xmlns:t="http://www.xml.org/xpe/token"
/>
The entire element is replaced by a unique token by the filter.
Example usage
The following example illustrates how the Token filter could be used within an XPE pipeline definition (xpipedef.xml) file:
<xpipeDef
xmlns="http://www.xml.org/xml/pipe"
>
<register
uri="xslt/tokengen"
>
<xslt
href="ROOT/test/xslt/tokengen.xsl"
/>
</register>
<register
uri="token"
>
<xpipe>
<xnode
type="http://www.xml.org/pipe/xpe/source/http"
/>
<xnode
type="xslt/tokengen"
/>
<xnode
type="http://www.xml.org/pipe/xpe/filter/token"
/>
<xsink
type="http://www.xml.org/pipe/xpe/sink/http"
>
<property
name="method"
value="xml"
/>
</xsink>
</xpipe>
</register>
</xpipeDef>
If tokengen.xsl contains the following:
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:import
href="copy.xsl"
/>
<xsl:output
method="xml"
/>
<xsl:template
match="http:httpRequest"
>
<result
xmlns=""
>
<id>
<t:token
xmlns:t="http://www.xml.org/xpe/token"
/>
</id>
</result>
</xsl:template>
</xsl:stylesheet>
Then executing the pipeline (via a HTTP GET) will produce XML similar to:
<result
xmlns=""
>
<id>
69f8dbaf:a
</id>
</result>