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

  • Home
  • SEARCH
  • 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 424493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:17:08+00:00 2026-05-12T19:17:08+00:00

I have a .xslt that translates xml from one form to another (I’m not

  • 0

I have a .xslt that translates xml from one form to another (I’m not using and xsd so I will not say from one schema to another). My problem is that the original file’s encoding of ' is lost in translation. This causes me a problem because in my database the names are stored using the apostrophe character not the single quote character and when I’m performing an update with this new data the names don’t match because the database has apostrophes in the names and the Java update code which reads my translated xml file has single quotes.

The original file has various lists of card elements that look like this (note value of the name element):

    <card>
        <cost>4BB</cost>
        <color>Black</color>
        <expansion-set>
            <rarity>R</rarity>
            <abbreviation>UD</abbreviation>
        </expansion-set>
        <type>Enchantment</type>
        <ruling>Vintage tournaments (see Rule 901) have restricted this
            card since 1999/10/01.</ruling>
        <ruling>Legacy tournaments (see Rule 902) have banned this card
            since 1999/10/01.</ruling>
        <ruling>Extended tournaments (see Rule 903) have banned this
            card since 1999/08/01.</ruling>
        <note>Note - Also see Skip, Rule G19.11.</note>
        <text>Text(UD): Skip your draw step. ; Pay 1 life: Draw a card.</text>
        <name>Yawgmoth&apos;s Bargain</name>
    </card>

This what the xslt template matches card elements and create the new form I am looking for:

    <xsl:template match="card">
        <card name="{name}">
            <!-- Add the card name -->
<!--            <xsl:attribute name="name">
                <xsl:value-of select="name"/>
            </xsl:attribute>
            <cardname><xsl:value-of select="name"/></cardname>  -->
            <!-- Add the card's rulings -->
            <xsl:apply-templates select="ruling"/>
            <!-- Add the card's notes -->
            <xsl:apply-templates select="note"/>
        </card>
    </xsl:template>

As you can see I am not transferring over everything just the parts I want and I’m turning the name element into an attribute (I have tried keeping the name as an element but see the same problem). The commented out parts are other attempts I have made to get the output I want (the current transform and those commented out all result in the same use of the single quote not the apostrophe).

Here is what a card element looks like in the translated output (note the different value of the name attribute):

<card name="Yawgmoth's Bargain">
<ruling ruleref="901">Vintage tournaments (see Rule 901) have restricted this card since 1999/10/01.</ruling>
<ruling ruleref="902">Legacy tournaments (see Rule 902) have banned this card since 1999/10/01.</ruling>
<ruling ruleref="903">Extended tournaments (see Rule 903) have banned this card since 1999/08/01.</ruling>
<note ruleref="G19.11">Note - Also see Skip, Rule G19.11.</note>
</card>

Now when my database update code (written in Java) reads in that XML, Yawgmoth’s Bargain has a single quote character in the string but the database I have created has the name using an apostrophe character. Needless to say my update code does not match the card names.

What is causing this loss of fidelity in the xsl transform?

thanks,

Ian

  • 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-12T19:17:08+00:00Added an answer on May 12, 2026 at 7:17 pm

    &apos; in xml uses the predefined entity reference for ' which is the unicode character number 39 (hex 27), APOSTROPHE which is ' which is what you have in your output.

    Your problem, then isn’t with the xslt processor.

    I presume you are getting one of the single quote characters: RIGHT SINGLE QUOTATION MARK (hex 2019). In which case something else (your database layer?) is ‘smartifying’ your apostrophe character.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xslt script that transforms an xml file to another xml file.
I have an XSLT that is transformed to an XML using System.Xml.Xsl.XslCompiledTransform . The
I have XSLT 1.0 standard. I have one dynamic XML from server which is
I have an XSLT stylesheet that transforms an XML file to JSON format and
I have to process XML files that have a DTD with a XSLT in
Lets say I have a xslt stylesheet like the following: <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet
i have complex xslt that formats xml to html now i need to be
I have an XSLT that transforms a XML to PLSQL I need to escape
I have written an xslt that reads some xml file names and does some
I have several different XSLT files that all work on the same original XML

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.