Skip to main content
1-Visitor
March 26, 2010
Question

import question: only if xpath true syntax on output attribute

  • March 26, 2010
  • 4 replies
  • 1043 views
Hi,
My import map (FrameMaker MIF to XML) is emitting:
morerows="0" namest="1" nameend="1"

on every <entry> (namest/end values increase with column position).

I'm trying to modify the "Only Output Attribute if XPath is True:" dialog to
only output something if namest != nameend and morerows if !=0.

Anyone know the right way to present the XPath syntax in that box?
@namest != @nameend

Does not work.

Neither do:
@morerows !=0
@morerows !="0"

--
Paul Nagai

    4 replies

    16-Pearl
    March 26, 2010
    Hi Paul,

    Your Xpath syntax seems correct, and I think XPath won't care about your
    string or non-string zero for the comparison you're doing.

    What might be tripping you up is that you're testing in the wrong spot.
    It's hard to tell without seeing your Import map file. How are the
    <entry> attributes being generated? Are they already in the ppXML once
    the first-stage import has done it's work on your MIF? If so, you might
    need to look more closely at how the tables are being handled - if it's
    a simple passthru type of thing that is handling the "table" element,
    then your rules for "entry" may never in fact be triggered (as the table
    will just be copied through as-is to the output XML).

    If you end up spinning your wheels on this, another method to consider
    is a second pass over the file to strip bad attributes. You can chain up
    (multiple) post-processes for one import job, I think it's under one of
    the option dialogs. You could add a simple XSLT post-process which
    whizzes through the file pulling out any stupid attributes. Just another
    idea in case you end up getting stuck under pressure (I know what that's
    like..).

    Cheers,
    Gareth

    naglists1-VisitorAuthor
    1-Visitor
    March 26, 2010
    Thanks, Gareth.

    Am a little further along, now. Turns out I was, uh, "unplugged" and
    reviewing a *copy* of my XML output that wasn't being refreshed by
    reprocessing the map template. Duh. The namest, nameend, and morerows are
    all working now. Funny how stuff like that helps 😉
    The correct (well, one set of correct) settings are:

    @namest != @nameend
    and
    @morerows != 0

    Oh, and FWIW, 1=0 on colname. Don't need that attr ever, I don't think.

    18-Opal
    March 26, 2010
    Heh, I hate it when I do that, it's always a real head smacker.



    "Why aren't my changes showing up in the output?!!!"



    "D'oh! I'm looking at the wrong output file!"



    BTW, XPath has a false() function for the situation you describe with
    colname. It's just a function that always returns false, since there's
    no literal "false" value in XPath. Your way (1 = 0) works just as well,
    but might be a little opaque to someone trying to debug the map template
    at some later date. (There's also a corresponding true() function for
    cases where you always want something to happen.)



    --Clay


    naglists1-VisitorAuthor
    1-Visitor
    March 26, 2010
    It took a dinner break for the light to go on.

    Subbed false() for 1=0. Guess this also protects me from quantum
    instabilities ...