IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: hansbm
About
User Name: hansbm
Forum Rank: Member
Real Name:
Location Netherlands
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Friday, August 18, 2017
Last Visit: Thursday, September 21, 2017 7:42:01 AM
Number of Posts: 11
[0.06% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Condition show element if exist
Posted: Tuesday, September 12, 2017 1:28:00 PM
I'm now trying to achieve the following.

I need to add telephone/fax/e-mail and other contact details in the mix. They display perfectly but I want to add "tel:"/"fax:"/"email:" before each value conditionally. Not all of these details are mandatory, some fields sometimes just aren't there in the XML file. I've entered the following XPath condition:
Code:
if (cac:Contact/cbc:Telephone) then "tel: " else ()

But this doesn't work. In the example XML given in this thread, the telephone number does exist. The phonenumer itself displays correct on the PDF. What's wrong with the XPath syntax? I have a feeling that the sub ("/") is not recognized.
Topic: Condition show element if exist
Posted: Wednesday, August 23, 2017 11:07:57 AM
You are right Sir! I'm sorry, I just realized that empty elements don't display!
I left them alone and made the text before an element conditional. In this example the conition is as follows:
Code:
if (cbc:AdditionalStreetName) then ", " else ()


I made a bunch of other conditions the same way. They all work beautiful.
Thank you.
Topic: Condition show element if exist
Posted: Wednesday, August 23, 2017 7:38:39 AM
The content needs NOT to be displayed if empty. That's why after the "else" I didn't enter any clause.

So when <cbc:AdditionalStreetName> doesn't have a value, skip it and move to the next (cbc:PostalZone>). The ", " (comma and space) also need not to be displayed.
I'll add the schema to the first post.

The condition
Code:
if (cbc:AdditionalStreetName) then cbc:AdditionalStreetName else

doesn't work in the XPath editor. I can't close the editor (by clicking OK button) because the syntax doesn't comply.
Topic: Condition show element if exist
Posted: Monday, August 21, 2017 11:28:15 AM
I've tried the following but that condition won't validate correctly:

if (cbc:AdditionalStreetName) then cbc:AdditionalStreetName else
Topic: Condition show element if exist
Posted: Monday, August 21, 2017 11:22:54 AM
I'm trying to build an Xpath condition which only shows an xml element when actual filled. Otherwise leave alone, no space or empty value.
It sounds really simple but I can't find an "if exists" condition. There is if-then-else but I'm not sure how to set this up in XPath/StyleVision.
See sps screenshot below.



Line 4, where the cbc:BuildingNumber element shows, starting with the comma I want to hide the cbc:AdditionalStreetName element when there is no value given in XML. See attached files. How would the condition look like? Should I use Xpath for that?
Topic: Align pricing info
Posted: Monday, August 21, 2017 9:34:26 AM
I read this in the help file http://manual.altova.com/Stylevision/stylevisionprofessional/index.html?svpres_inputformatting_syntax.htm

Quote:
Example of Value Formatting for an xs:decimal datatype:

"$"(##0.00)

Examples of the output would be:

$ 25.00
$ 25.42
$267.56


Thought his would right align the numbers.
Topic: Align pricing info
Posted: Monday, August 21, 2017 8:33:26 AM
About aligning numbers, see picture below.
I'm building a template for displaying invoices. All prices content are value formatted in decimal, "€" (###0.00).
Pricing is rendered in a table with no left or right aligning in the stylesheet/styles. Why don't all prices correctly align to the right side? I thought that the leading ### would take care of that?

Topic: Looping through values, output
Posted: Sunday, August 20, 2017 8:10:01 PM
The filter seems to do the right magic! Thanks.
Topic: Looping through values, output
Posted: Friday, August 18, 2017 3:09:48 PM
Thank you K101. That seems to put things on the right spot!
I'll do some more testing after the weekend.
Topic: Looping through values, output
Posted: Friday, August 18, 2017 12:58:53 PM
I'm building a xml-mapping file based on XSLT1.0. It's for building e-invoices. All values will be passing on to another backend system.
The invoice item lines two different variations of taxes (VAT). There is a 6% VAT and a 21% VAT tax.

The following is a part of the XML of an e-invoice:
Code:
<cac:TaxTotal>
      <cbc:TaxAmount currencyID="EUR">16.54</cbc:TaxAmount>
      <cac:TaxSubtotal>
             <cbc:TaxableAmount currencyID="EUR">10.55</cbc:TaxableAmount>
             <cbc:TaxAmount currencyID="EUR">0.63</cbc:TaxAmount>
             <cac:TaxCategory>
                  <cbc:ID schemeID="UNCL5305">S</cbc:ID>
                  <cbc:Percent>6.00</cbc:Percent>
                  <cac:TaxScheme>
                         <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
                  </cac:TaxScheme>
               </cac:TaxCategory>
        </cac:TaxSubtotal>
        <cac:TaxSubtotal>
                 <cbc:TaxableAmount currencyID="EUR">75.75</cbc:TaxableAmount>
                 <cbc:TaxAmount currencyID="EUR">15.91</cbc:TaxAmount>
                 <cac:TaxCategory>
                       <cbc:ID schemeID="UNCL5305">S</cbc:ID>
                       <cbc:Percent>21.00</cbc:Percent>
                       <cac:TaxScheme>
                            <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
                       </cac:TaxScheme>
                 </cac:TaxCategory>
         </cac:TaxSubtotal>
</cac:TaxTotal>

The two different taxes (6% & 21%) need to be mapped to output fields "VAT1" and "VAT2".

How can I loop through each cac:TaxTotal\cac:TaxSubtotal and have the the value of "cbc:TaxAmount" be passed on to the "VAT1" and "VAT2" fields?

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.