#3 Have the option to enclose the message text in a tag

open
nobody
5
2007-02-25
2007-02-25
Robert Weber
No

Have the option to enclose the message text in a tag instead of an attribute.

I have been using barcode4j 1.0 for over a year in my company's account management application for generated bar-coded payment coupons. We generate these coupons using various XSLTs and (ultimately) FOP. During one phase of the transformation we do value-replacement on custom XML tags. The message of the barcode is inserted using one of the value-replacement tags.

It proved to be too time-consuming to attempt to write the XSLT to replace the message attribute of the barcode, so instead we patched barcode4j to allow for the insertion of the message into a message tag. For example:

<barcode>
<message>foo</message>
</barcode>

instead of:

<barcode message="foo">
</barcode>

I will attach DIFF files when I get a chance.

Discussion

  • Logged In: YES
    user_id=1787638
    Originator: NO

    Can you please provide the diff to implement the message attribute via xml tags as explained above? Or are there other possibilities to generate variable barcodes with fop?

    regards, mikes222

     
  • Robert Weber
    Robert Weber
    2008-05-13

    barcod4j 1.0 message as tag or attribute under FOP

     
  • Robert Weber
    Robert Weber
    2008-05-13

    Logged In: YES
    user_id=1366456
    Originator: YES

    Note that this DIFF is only applicable (as far as I know) for use with the 0.20 line of FOP and the 1.0 line of barcode4j. This DIFF is created against the barcode4j_1_0 tag from CVS. I don't remember if I obtained my original source from CVS or a source distribution, though. At any rate, whatever my source is, it was marked as 1.0.

    Also, it has been so long since I have touched this that the accuracy of this DIFF might be questionable. That is, it is possible that I am missing something.

    But do try it out, and let me know if it works for you.
    File Added: barcod4j_1_0_message_as_tag.zip

     
  • Logged In: YES
    user_id=1787638
    Originator: NO

    Thanks for your quick reply. After a while of searching in google I found a suggestion to the solution in a german forum. It is so easy :-)

    <bc:barcode message="{ean}">
    <bc:ean13>
    </bc:ean13>
    </bc:barcode>

    ean is the xml tag of the data file

    <article>
    <ean>1234567890128</ean>
    <shortDesc>A simple article</shortDesc>
    <qty>1</qty>
    <prize>59,90</prize>
    </article>

    And it works!

    regards,
    mikes222

     
  • Logged In: YES
    user_id=225352
    Originator: NO

    Frankly, I'm at a loss to understand why generating an element is less time-consuming than generating an attribute in XSLT.

    Element:
    <xsl:template name="xy">
    <barcode>
    <message><xsl:value-of select="mymsg"/></message>
    <barcode>
    </xsl:template>

    Attribute
    <xsl:template name="xy">
    <barcode>
    <xsl:attribute name="message">
    <xsl:value-of select="mymsg"/>
    </message>
    <barcode>
    </xsl:template>

    Both variants are so simple.

     
  • Robert Weber
    Robert Weber
    2008-05-14

    Logged In: YES
    user_id=1366456
    Originator: YES

    > Frankly, I'm at a loss to understand why generating an element is less
    > time-consuming than generating an attribute in XSLT.

    When you are able to implement the solution in that manner, it DOES make sense. However, when I originally implemented the barcode generation feature in the system I was maintaining, it was less time consuming for me to hack the barcode4j source than it was to understand the XSLT mumbo jumbo that was already in place in the system.

    That's why :)