Giter VIP home page Giter VIP logo

Comments (6)

lovettchris avatar lovettchris commented on May 28, 2024

Hmm, this one is a bit tricky, if I turn on "Preserve Whitespace" in the XML Document then you will see this:

image

I assume you do not want to see whitespace like this, or do you? In order to have full control over whitespace in the document (and see it in the XSLT transform) you kind of need this, but it's pretty tedious...?

The alternative (1) is I hide all these nodes in the XML notepad UI, but I load the whitespace nodes into the document so XSLT transforms can see the whitespace.

Alternative (2) which saves memory, would be to not load any whitespace into the document, but before I run the XSLT transform I save the document with pretty printing turned on (which xml notepad save is doing already) and then I feed that saved document with whitespace to the XSLT transform. The downside of this is that for very large documents this could add a lot of time before you see the XSLT output due to having to save and reload that doc into the transform.

What is your preference?

from xmlnotepad.

lovettchris avatar lovettchris commented on May 28, 2024

I ended up adding a new Option under formatting called "Preserve Whitepsace" so you can play with that (in the main branch) and see what you think, after turning it on you will need to reload your XML doc and you will see the above #whitespace nodes.

from xmlnotepad.

Pierre-de-la-Verre avatar Pierre-de-la-Verre commented on May 28, 2024

Hi Chris
I'm not sure we are talking about the same topic.

I have this XML in UTF-8:

<?xml version="1.0" encoding="utf-8"?>
<DSS_2015_LV95.Siedlungsentwaesserung.Einzugsgebiet TID="12684">
  <OBJ_ID>12684</OBJ_ID>
  <Metaattribute>
    <SIA405_Base_LV95.Metaattribute>
      <Letzte_Aenderung>20211124</Letzte_Aenderung>
    </SIA405_Base_LV95.Metaattribute>
  </Metaattribute>

</DSS_2015_LV95.Siedlungsentwaesserung.Einzugsgebiet>

This XSLT (ident copy):

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@*|node()">
    <xsl:copy >
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

With your xsl.exe 1.0 from your XMLTools 2023-01-27 I use this command:
xsl -s ident_kopie.xslt mini.xml

and get this result:

<?xml version="1.0" encoding="utf-8"?><DSS_2015_LV95.Siedlungsentwaesserung.Einzugsgebiet TID="12684">
  <OBJ_ID>12684</OBJ_ID>
  <Metaattribute>
    <SIA405_Base_LV95.Metaattribute>
      <Letzte_Aenderung>20211124</Letzte_Aenderung>
    </SIA405_Base_LV95.Metaattribute>
  </Metaattribute>

</DSS_2015_LV95.Siedlungsentwaesserung.Einzugsgebiet>

Using the same in XMLNotepad I get this result - with missing line-breaks:

<?xml version="1.0" encoding="utf-8"?><DSS_2015_LV95.Siedlungsentwaesserung.Einzugsgebiet TID="12684"><OBJ_ID>12684</OBJ_ID><Metaattribute><SIA405_Base_LV95.Metaattribute><Letzte_Aenderung>20211124</Letzte_Aenderung></SIA405_Base_LV95.Metaattribute></Metaattribute></DSS_2015_LV95.Siedlungsentwaesserung.Einzugsgebiet>

from xmlnotepad.

lovettchris avatar lovettchris commented on May 28, 2024

Please re-read my answers, this is about "preserving whitespace" in the XML Document, which XML notepad does not do by default. But xsl.exe does preserve the whitespace by default. Try my new Preserve Whitespace setting and you will get the XSL output you are looking for.

from xmlnotepad.

lovettchris avatar lovettchris commented on May 28, 2024

New Preserve Whitespace formatting option is available in https://github.com/microsoft/XmlNotepad/releases/tag/2.9.0.9

from xmlnotepad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.