xsl-list
[Top] [All Lists]

Re: [xsl] Suggestions for filtering algorithm

2019-12-18 09:29:57
Here is my attempt at filtering by getting a regular expression pattern to
apply against my input. Here is the filter document:

 

<?xml version="1.0" encoding="UTF-8"?>

<filter>

    <exclude>HOSE ASSEMBLY</exclude>

    <exclude>HOSE ASSY</exclude>

    <exclude>HOSE SEGMENT</exclude>

    <exclude>SHIM SET</exclude>

    <exclude>STUD</exclude>

    <exclude>PIPE SEGMENT</exclude>

    <exclude>MANIFOLD-WATER</exclude>

</filter>

 

And here is my XSLT shell:

 

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

    xmlns:xs="http://www.w3.org/2001/XMLSchema";

    xmlns:rq="http://www.frameexpert.com/functions";

    exclude-result-prefixes="xs"

    version="2.0">

    

    <xsl:variable name="excludes-regex-pattern">

        <xsl:value-of select="rq:getRegex(doc('Parts_Filter.xml'))"/>

    </xsl:variable>

    

    <xsl:template match="/">

        <xsl:message select="$excludes-regex-pattern"></xsl:message>

    </xsl:template>

    

    <xsl:function name="rq:getRegex">

        <xsl:param name="excludes"/>

        <xsl:text>(</xsl:text>

        <xsl:value-of select="$excludes/descendant::exclude" separator="|"/>

        <xsl:text>)</xsl:text>

    </xsl:function>

    

</xsl:stylesheet>

 

Any comments and suggestions are welcome. Thanks.

 

Rick

 
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>