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: jduteau
About
User Name: jduteau
Forum Rank: Newbie
Real Name:
Location
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Wednesday, January 13, 2021
Last Visit: Wednesday, October 18, 2023 5:05:27 PM
Number of Posts: 5
[0.03% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Inserting all XML content verbatim
Posted: Wednesday, October 18, 2023 5:05:00 PM
I have an XML document that contains a bunch of HTML tags that I want to insert verbatim, i.e. all of the elements, attributes and text content.

Code:

section
    text
        status value="additional"
        div xmlns="http://www.w3.org/1999/xhtml"
            div style="narrative"
                various and sundry html tags
            div
        div
    text
section


(ARGH, forums won't let me post the XML in the post. I've attached it instead.)

I want to grab the div with style = "narrative" and insert all of the html nodes as is into my HTML document. I can't see how to do that in StyleVision.

Thanks.
Topic: Reversing an XML hierarchy
Posted: Sunday, September 10, 2023 11:31:40 PM
I have an XML hierarchy that I need to transform into a different representation but with the hierarchy reversed. Here is a simple example (with the xml brackets removed to get it into the form):

Code:

content
   quantity value="12"
   product
      ...product A info
   product
   content
     quantity value="4"
     product
        ...product B info
     product
     content
        quantity value="1"
        product
           ...product C info
        product
     content
   content
content

This needs to be transformed into something like this:

Code:

product
  ...product C info
  contains
      quantity value="4"
      product
      ...product B info
      contains
          quantity value="12"
          product
            ...product A info
          product
     contains
     product
  contains
product

I've made a transform that almost does the above except that Product A/B/C stay in that order. I can't see how I could write the transform to start at the innermost info and work its way out. Does anyone have advice on how I could do that?
Topic: Create a user-defined function with a node as input?
Posted: Friday, January 15, 2021 6:40:22 AM
I am trying to simplify my mappings and one way I thought I could simplify is by creating a user-defined function to take a node as an input so that I can output a string based on the node's name and position. But I can't see a way to set the input of my user-defined function to be a node. node isn't one of the listed types in the dropdown for Simple inputs.
Topic: Reusing a generated string in a mapping
Posted: Thursday, January 14, 2021 5:38:44 PM
I had reached out to Altova support and they suggested using the position() function as well. I'll try to do that, but your suggestion of doing a two-pass generation might also work. Basically create the output with just the initial IDs and then do a 2nd pass to link up all of the IDs appropriately.
Topic: Reusing a generated string in a mapping
Posted: Wednesday, January 13, 2021 11:24:03 PM
I have an output XML that I am mapping to that has the need for entry IDs that are generated. I also need to reference the generated ID in other areas of the XML.

Here is an example (not the actual XML I'm mapping to):

<entry>
<id value="auto-generate-1"/>
...
</entry>
<entry>
<id value="auto-generate-2"/>
...
<sourceUrl = "constant-text / auto-generate-1"/>
</entry>
<entry>
<id value="auto-generate-3"/>
...
<reference parentId="auto-generate-1" childId="auto-generate-2"/>
</entry>

The sourceUrl element shows that sometimes I need to take the generated string and concatenate some other strings to it.

I currently have this working using auto-number into X compute-when:once variables and then I use those variables where I need them. This works because I know for this specific mapping that I only have X ids to generate. But my next mapping has an arbitrary number of entries and therefore an arbitrary number of IDs to generate.

I tried to simply put the auto-number into the ID input and then connect the ID output to the reference/parentID input, but that just made a circular reference error.

Is there some other way to auto-generate some text into an output and then reuse that generated text in other places in the output?

Thanks in advance,

Jean

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