Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9224703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:23:23+00:00 2026-06-18T04:23:23+00:00

I am trying to build an XSD which constrains a particular node to be

  • 0

I am trying to build an XSD which constrains a particular node to be an “inline” stylesheet.

It would probably look something like this:

<complexType name="InlineXslt">
  <sequence>
    <any minOccurs="1" maxOccurs="1" FORCE_NAMESPACE="http://www.w3.org/1999/XSL/Transform" />
  </sequence>
</complexType>

or perhaps…

<complexType name="InlineXslt">
  <sequence>
    <element name="stylesheet" minOccurs="1" maxOccurs="1" FORCE_NAMESPACE="http://www.w3.org/1999/XSL/Transform" />
  </sequence>
</complexType>

Of course there is no FORCE_NAMESPACE attribute, but the idea is to force the node to use the XSL namespace. Is there an equivelant syntax that would allow me to specify this restriction? The conforming XML would look like this:

<InlineXslt>
  <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
    <... etc ...>
  </stylesheet>
</InlineXslt>

If I omit the (non-existent) “FORCE_NAMESPACE” attribute on the first XSD example, it does work, but it is not enforced. Due to the use of the “any” element, the user could put anything they want in there, including a node which isn’t named “stylesheet” and using any namespace they choose.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:23:25+00:00Added an answer on June 18, 2026 at 4:23 am

    Short answer:

    The FORCE_NAMESPACE attribute you would like for xs:any exists; it’s called namespace. (It may differ from your FORCE_NAMESPACE in allowing more than one namespace name.) The FORCE_NAMESPACE attribute you would like for xs:element does not exist, because it’s not needed; the functionality you are looking for is achieved using the ref attribute and a qualified name.

    Longer answer:

    If you want elements whose type is InlineXslt to contain an xslt:stylesheet element, the simplest way to achieve it is to say so:

    <xs:complexType name="InlineXslt">
      <xs:sequence>
        <xs:element ref="xsl:stylesheet" 
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
      </xs:sequence>
    </xs:complexType>
    

    This will require that your schema document import the XSLT namespace, so at the top of the schema document you’ll have something like:

    <xs:import namespace="http://www.w3.org/1999/XSL/Transform"/>
    

    If you want to allow the top-level element to be either stylesheet or transform, write a choice:

    <xs:complexType name="InlineXslt2">
      <xs:choice 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xs:element ref="xsl:stylesheet"/>
        <xs:element ref="xsl:transform"/>
      </xs:choice>
    </xs:complexType>
    

    If you want to allow arbitrary XSLT elements (sounds like a semantic nightmare in your particular case, but as an example), use a wildcard that specifies that any element from the XSLT namespace is accepted:

    <xs:complexType name="InlineXslt3">
      <xs:choice>
        <xs:any namespace="http://www.w3.org/1999/XSL/Transform"
         maxOccurs="unbounded"/>
      </xs:choice>
    </xs:complexType>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying build a method which returns the shortest path from one node to
I'm trying to parse a custom XSD to build a list of elements which
I am trying to do something like this: DECLARE @MySchema VARCHAR(MAX) SELECT @MySchema =
Trying to build openssl-fips-2.0 with NDK, before I was lucky found this link and
I'm currently trying to build my project with maven and sqlite4java. Which is available
I have a set of classes build using xsd.exe, and I am trying to
I am trying to build a C# class from a XSD file. In short
I am trying build a jQuery EasyUI datagrid or treegrid out of a large
I was trying Build For Archiving application (from Titanium Mobile) with xCode 4.4, but
I'm trying build an App Engine connected Android application and am having some problems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.