Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Stripping null characters from XML elements

Stripping null characters from XML elements

Scheduled Pinned Locked Moved XML / XSL
xmlhardwareregexquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CBoland
    wrote on last edited by
    #1

    I'm transforming xml and want to strip out null characters in the elements. The elements look like this: ��� My XSL rules look like this: For the 'select=' attribute, I've tried: - translate(/myEl, �, 'x') - translate(/myEl, '�', 'x') - translate(/myEl, '�', 'x') - translate(/myEl, '�', 'x') - translate(/myEl, '�', 'x') - translate(string(/myEl), '�', 'x') - translate(string(/myEl), '�', 'x') I've also tried at the root, but no effect. I'm translating null to 'x' for now so I know that I'm capturing the nulls correctly, but never get a match; my output always has with nulls embedded in it. The output xml is otherwise well-formed. Anyone know what I'm doing wrong?

    C 1 Reply Last reply
    0
    • C CBoland

      I'm transforming xml and want to strip out null characters in the elements. The elements look like this: ��� My XSL rules look like this: For the 'select=' attribute, I've tried: - translate(/myEl, �, 'x') - translate(/myEl, '�', 'x') - translate(/myEl, '�', 'x') - translate(/myEl, '�', 'x') - translate(/myEl, '�', 'x') - translate(string(/myEl), '�', 'x') - translate(string(/myEl), '�', 'x') I've also tried at the root, but no effect. I'm translating null to 'x' for now so I know that I'm capturing the nulls correctly, but never get a match; my output always has with nulls embedded in it. The output xml is otherwise well-formed. Anyone know what I'm doing wrong?

      C Offline
      C Offline
      CBoland
      wrote on last edited by
      #2

      I solved the problem, which had nothing to do with the XPath queries. My XSL stylesheet is a Content file in a VS.NET project. I forgot that VS DOESN'T copy content files to the output folder. Thus, all of my stylesheet edits were never used! This is what I ultimately used to remove the nulls: translate(/myEl, '�', '') Does anyone know why VS doesn't copy content files to output folder?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups