Re: Typeswitch Output Formatting

Peter Stadler <[email protected]>
Newsgroups gmane.text.xml.exist
Message-ID <[email protected]>
Isn’t that the whitespace before and after the element <ExcludedDistributionChannel>?
You might try to apply your typeswitch function to only the child elements (not all nodes) of the <DealTerms>  and then reintroduce the indentation via serialization settings.

Cheers
Peter


> Am 18.08.2022 um 00:15 schrieb Adam Retter <[email protected]>:
> 
> I am not sure immediately why you get an extra line break. As an experiment if you replace "return ()" with "return text {}", do you see the same result?
> 
> On Tue, 16 Aug 2022, 03:53 Nick Sincaglia, <[email protected] <mailto:[email protected]>> wrote:
> I have wrote a Typeswitch function in which I want to remove an XML tag if it is present.
> 
> My typeswitch function looks something like this:
> 
>     for $node in $nodes
>     return
>         typeswitch ($node)
>             (:Ignore text and comments:)
>             case text() return $node
>             case comment() return $node
>             case element(ExcludedDistributionChannel) return ()
>             default return my-typeswitch-transform:dispatch-recurse($node)
> 
> My input looks something like this:
> let $input :=
>         <DealTerms>
>           <TerritoryCode>AD</TerritoryCode>
>           <ExcludedDistributionChannel>
>             <PartyName>
>               <FullName>Adaptr</FullName>
>             </PartyName>
>           </ExcludedDistributionChannel>
>           <PriceInformation>
>             <PriceRangeType>Budget</PriceRangeType>
>           </PriceInformation>
>           <ValidityPeriod>
>             <StartDateTime>2022-12-01T02:35:00Z</StartDateTime>
>           </ValidityPeriod>
>         </DealTerms>
> 
> When I look at my output, I get this:
> 
> let $output :=
>         <DealTerms>
>           <TerritoryCode>AD</TerritoryCode>
> 
>           <PriceInformation>
>             <PriceRangeType>Budget</PriceRangeType>
>           </PriceInformation>
>           <ValidityPeriod>
>             <StartDateTime>2022-12-01T02:35:00Z</StartDateTime>
>           </ValidityPeriod>
>         </DealTerms>
> 
> Is there anything I can do to remove the new line character from the output, which the typeswitch function seems to add?
> 
> I know that this white space is inconsequential to the processing of this document but if I could remove it, I would like to.
> 
> Nick
>  --
> Nick Sincaglia
> President/Founder
> NueMeta, LLC
> Digital Media & Technology
> Phone: +1-630-303-7035
> [email protected] <mailto:[email protected]>
> http://www.nuemeta.com <http://www.nuemeta.com/>
> Skype: nsincaglia
> _______________________________________________
> Exist-open mailing list
> [email protected] <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/exist-open <https://lists.sourceforge.net/lists/listinfo/exist-open>
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE3J1m1lawAcPMtY+alyWbobr1erYFAmL90mEACgkQlyWbobr1
erYAfwgAoe/9ULBsJebXMOLoyYLLyNxRuLS5DvsQIQPae426+yD+sCkOT4Kg4V9Z
S5SU/502p4t94E2YSft0peWo/Tp+Tr7Uq+TibDAREBlTtJdYmIt614d0FxubKXfI
hlqvKh6e76YxLdrxjT7zQqimKIJVcSV5oX4bfh60wUY+Qeti8FhTEeAvp5ZTnU0/
45BK3Yi5wIMEqEao9hr+9Z/koibKO79OTRVySNdD24fmazazFqZQIBbL1yVEH6Gq
NXGqQau4pjWQD4VRVI1TSjhor9PHMyxVcjfsW8lAIKO0UqlvgWkTy2AnHdtqDbey
rtWFa3pF5bMfAlkJn8JGjq99Ep4Qmw==
=bt6v
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.