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 6249379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:13:42+00:00 2026-05-24T13:13:42+00:00

I have an XML document that looks like this: <?xml version=1.0 encoding=utf-8?> <Schema Namespace=EDIManagement.Models.Store

  • 0

I have an XML document that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="EDIManagement.Models.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator">
  <EntityType Name="AccountRemark">
    <Key>
      <PropertyRef Name="AccountRemarkId" />
    </Key>
    <Property Name="AccountRemarkId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
    <Property Name="AccountId" Type="int" Nullable="false" />
    <Property Name="RemarkTypeId" Type="int" Nullable="false" />
    <Property Name="RemarkEnteredAt" Type="datetime" Nullable="false" />
    <Property Name="EnteredBy" Type="nvarchar" Nullable="false" MaxLength="100" />
    <Property Name="Remark" Type="nvarchar(max)" Nullable="false" />
    <Property Name="LastEditedBy" Type="nvarchar" Nullable="false" MaxLength="100" />
  </EntityType>
</Schema>

I am trying to transform it with XSLT so that the new document is identical, with just one line of difference. The line to be changed is this:

    <Property Name="Remark" Type="nvarchar(max)" Nullable="false" />

It should be transformed into this:

    <Property Name="Remark" Type="nvarchar" Nullable="false" MaxLength="300" />

My XSLT transform so far looks like this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
  xmlns:def="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"
>
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"  />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="def:EntityType/def:Property[@Type='nvarchar(max)']/@*" >
    <xsl:choose>
      <xsl:when test="@Type='nvarchar(max)'">
        <xsl:attribute name="Type">nvarchar</xsl:attribute>
        <xsl:attribute name="MaxLength">300</xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy></xsl:copy>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

I’m stepping through the transform with Visual Studio 2010 debugging, and I see that it correctly activates the [@Type='nvarchar(max)']/@* template. The only problem is that the xsl:when test="@Type='nvarchar(max)'" never tests as true. Of course this is bizarre, because if the template itself matched, then this identical condition should match as well.

But because the when test strangely doesn’t become true, my target doesn’t get transformed at all, and I simply end up with an exact copy of the original document. If I change the when clause to xsl:when test="1=1" then it finally tests as true, which demonstrates that overall the transform is correct. But this still begs the question: why is the proper expression never becoming true?

I’m just simply unable to figure why the proper test expression never becomes true. Ideas?

  • 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-05-24T13:13:44+00:00Added an answer on May 24, 2026 at 1:13 pm

    Use this template:

    <xsl:template match="def:EntityType/def:Property[@Type = 'nvarchar(max)']">
      <xsl:copy>
        <xsl:apply-templates select="@*"/>
        <xsl:attribute name="Type">nvarchar</xsl:attribute>
        <xsl:attribute name="MaxLength">300</xsl:attribute>
      </xsl:copy>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i have an XML document that looks like this: <?xml version=1.0 encoding=UTF-8?> <gesmes:Envelope
Say I have a xml document that looks like this <foo> <bar id=9 />
I have an XML document that looks like this: <kmsg xmlns=http://url1 xmlns:env=url1 xmlns:xsi=http://www.w3.org/2001/XMLSchemainstance xsi:schemaLocation=http://location
I have some XML that looks something like this: <Root> <Documents> <Document id=1/> </Documents>
I have a simple xml document that looks like the following snippet. I need
I have a XML document which looks something like this: <events> <event category=gymnastics subcategory=rhythmic
In my Python app, I have an XML document that I'd like to transform
I've got a 2-part question... I have some XML that looks like: <trans-unit id=70
I have an XML document that I'm trying to style via CSS. A relevant
I have a large xml document that needs to be processed 100 records at

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.