getting around the built in type restriction of a Basic XSLT processor

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

getting around the built in type restriction of a Basic XSLT processor

Ihe Onwuka-2
I have a sequence of keywords which I would like to create as empty elements if their content constitutes a valid element name but I cannot execute the following because of the above restriction that prevents the comparison to xs:NCName

Code is below. 

        <xsl:for-each select="tokenize(substring-after(.,'&#9;'),'\t')">
          <xsl:choose>
            <xsl:when test=". castable as xs:NCName">
              <xsl:element name="{.}"/>
            </xsl:when>
            <xsl:otherwise>
              <keyword name="{.}"/>
            </xsl:otherwise>
         </xsl:for-each>

I have tried the allow-all-built-in-types saxon attribute and that hasn't worked. 

Any other suggestions.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: getting around the built in type restriction of a Basic XSLT processor

Michael Kay
The XSLT 2.0 spec restricts the set of types available in a non-schema-aware processor. Schema awareness comes only with Saxon-EE.

The extension attribute saxon:allow-all-built-in-types removes the restriction (making the processor non-conformant), but like all extensions in the Saxon namespace, it is available only with Saxon-PE or higher.

If it's only the castable test you are after, you could use matches(., '\i\c*')

Michael Kay
Saxonica
+44 (0) 118 946 5893




On 30 Nov 2014, at 20:28, Ihe Onwuka <[hidden email]> wrote:

I have a sequence of keywords which I would like to create as empty elements if their content constitutes a valid element name but I cannot execute the following because of the above restriction that prevents the comparison to xs:NCName

Code is below. 

        <xsl:for-each select="tokenize(substring-after(.,'&#9;'),'\t')">
          <xsl:choose>
            <xsl:when test=". castable as xs:NCName">
              <xsl:element name="{.}"/>
            </xsl:when>
            <xsl:otherwise>
              <keyword name="{.}"/>
            </xsl:otherwise>
         </xsl:for-each>

I have tried the allow-all-built-in-types saxon attribute and that hasn't worked. 

Any other suggestions.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: getting around the built in type restriction of a Basic XSLT processor

Ihe Onwuka-2

On Sun, Nov 30, 2014 at 10:32 PM, Michael Kay <[hidden email]> wrote:
The XSLT 2.0 spec restricts the set of types available in a non-schema-aware processor. Schema awareness comes only with Saxon-EE.

The extension attribute saxon:allow-all-built-in-types removes the restriction (making the processor non-conformant), but like all extensions in the Saxon namespace, it is available only with Saxon-PE or higher.

If it's only the castable test you are after, you could use matches(., '\i\c*')


This returns true for matches('1880s','\i\c*') in Saxon XSLT and Zorba.


On 30 Nov 2014, at 20:28, Ihe Onwuka <[hidden email]> wrote:

I have a sequence of keywords which I would like to create as empty elements if their content constitutes a valid element name but I cannot execute the following because of the above restriction that prevents the comparison to xs:NCName

Code is below. 

        <xsl:for-each select="tokenize(substring-after(.,'&#9;'),'\t')">
          <xsl:choose>
            <xsl:when test=". castable as xs:NCName">
              <xsl:element name="{.}"/>
            </xsl:when>
            <xsl:otherwise>
              <keyword name="{.}"/>
            </xsl:otherwise>
         </xsl:for-each>

I have tried the allow-all-built-in-types saxon attribute and that hasn't worked. 

Any other suggestions.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: getting around the built in type restriction of a Basic XSLT processor

Ihe Onwuka-2
ah hah... the regex needs to start with a ^ and is '^\i\c*'

On Mon, Dec 1, 2014 at 8:06 AM, Ihe Onwuka <[hidden email]> wrote:

On Sun, Nov 30, 2014 at 10:32 PM, Michael Kay <[hidden email]> wrote:
The XSLT 2.0 spec restricts the set of types available in a non-schema-aware processor. Schema awareness comes only with Saxon-EE.

The extension attribute saxon:allow-all-built-in-types removes the restriction (making the processor non-conformant), but like all extensions in the Saxon namespace, it is available only with Saxon-PE or higher.

If it's only the castable test you are after, you could use matches(., '\i\c*')


This returns true for matches('1880s','\i\c*') in Saxon XSLT and Zorba.


On 30 Nov 2014, at 20:28, Ihe Onwuka <[hidden email]> wrote:

I have a sequence of keywords which I would like to create as empty elements if their content constitutes a valid element name but I cannot execute the following because of the above restriction that prevents the comparison to xs:NCName

Code is below. 

        <xsl:for-each select="tokenize(substring-after(.,'&#9;'),'\t')">
          <xsl:choose>
            <xsl:when test=". castable as xs:NCName">
              <xsl:element name="{.}"/>
            </xsl:when>
            <xsl:otherwise>
              <keyword name="{.}"/>
            </xsl:otherwise>
         </xsl:for-each>

I have tried the allow-all-built-in-types saxon attribute and that hasn't worked. 

Any other suggestions.



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: getting around the built in type restriction of a Basic XSLT processor

John Lumley-2
In reply to this post by Ihe Onwuka-2
On 1 Dec 2014, at 08:06, Ihe Onwuka <[hidden email]> wrote:

If it's only the castable test you are after, you could use matches(., '\i\c*')


This returns true for matches('1880s','\i\c*') in Saxon XSLT and Zorba.

Perhaps the match should be anchored: matches(.,'^\i\c*$')

John Lumley

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: getting around the built in type restriction of a Basic XSLT processor

Ihe Onwuka-2
yes otherwise it would return true for things like man's-hat .

On Mon, Dec 1, 2014 at 8:15 AM, John Lumley <[hidden email]> wrote:
On 1 Dec 2014, at 08:06, Ihe Onwuka <[hidden email]> wrote:

If it's only the castable test you are after, you could use matches(., '\i\c*')


This returns true for matches('1880s','\i\c*') in Saxon XSLT and Zorba.

Perhaps the match should be anchored: matches(.,'^\i\c*$')

John Lumley


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help