Howto optionally include an attribute on an element in a JSP document ?

I cannot find a way to optionally include an attribute on an element in a JSP document (JSPX). My JSP document is used to create an XML according to an XML schema where some element are declared as optional by the schema (default for element attributes).
I've tried:
a)
<elem <c:if test="${!empty obj.attr}">attr=${obj.attr}</c:if>>
</elem>b)
<jsp:element name="elem">
   <c:if test="${!empty obj.attr}">
      <jsp:attribute name="attr">${obj.attr}</jsp:attribute>
   </c:if>
   <jsp:body>
   </jsp:body>
</jsp:element>And none of them work. Any ideas?

I cannot find a way to optionally include an attribute on an element in a JSP document (JSPX). My JSP document is used to create an XML according to an XML schema where some element are declared as optional by the schema (default for element attributes).
I've tried:
a)
<elem <c:if test="${!empty obj.attr}">attr=${obj.attr}</c:if>>
</elem>b)
<jsp:element name="elem">
   <c:if test="${!empty obj.attr}">
      <jsp:attribute name="attr">${obj.attr}</jsp:attribute>
   </c:if>
   <jsp:body>
   </jsp:body>
</jsp:element>And none of them work. Any ideas?

Similar Messages

  • Creating an Element for an XML Document

    Assuming I have an XML file
    file.xml
    <root>
    <child1>
    <child2>
    <child100>
    <root>
    i do
    SAXBuilder parser = new SAXBuilder();
    doc = parser.build(file);
    root = doc.getRootElement();This returns a root elemnet for the entire tree.Now my question is how do i create a root element for say jus the top 10 children? That is, is there a way i can create a document just reading the first 10 elements from the file tree above so that when i do a getChildren on root I should have only 10 elements in the list.

    | 1. How are the attributes of an XML element can be stored to the database
    XML SQL Utility (which XSQL uses under the covers) only stores
    documents in the canonical format. You'll need to use an XSLT
    transformation to transform data into the canonical format
    (including transforming attribute values into elements whose
    names correspond to the column in which you'd like to store it)
    | 2. How can I store a single XML document to multiple database tables?
    I outline several techniques for this in my upcoming
    O'Reilly book, "Building Oracle XML Applications".
    The basic idea is to either:
    (1) Use an Object View with an INSTEAD OF INSERT trigger, or
    (2) Use a technique that transform the inbound document
    into a multi-table insert-format and passes each
    relevant part for insert to the XML SQL Utility separately.
    null

  • XML element,if not including any attributes and/or child elements then

    XML element in SQLX,if not including any attributes and/or child elements then the tag should not appear, how to achive this?
    ex:Consider for <enumeration> tag where it is having some value.
    <attribute>
    <name>Ethernet Access</name>
    <enumeration>
    <StringValue>Bandwidth</StringValue>
    </enumeration>
    </attribute>
    When <enumeration> tag is not have any Value in this, then output should be as follows.
    <attribute>
    <name>Ethernet Access</name>
    </attribute>
    But what i am getting is
    <attribute>
    <name>Ethernet Access</name>
    </enumeration>
    </attribute>
    Please suggest me the solution for this.
    I tried , but when xmlelement() is not having data it will display empty tag ie </enumeration>, If xmlforest() are null it wont show tag, But i have to use xmlelement only. how can that be achived using xmlelement .

    Use a SQL case - when - else end construct to only execute the xmlelement if data is present. The SQL/XML standard is very clear, xmlElement will generate an empty element if no data is present. xmlforest will not.

  • Include BLANK OPTION  for an attribute dropdownlist in tx: COMM_ATTRSET

    Hello experts,
    I would like to add a BLANK OPTION for an attribute dropdownlist, I have tried to add  a space character in "Value Range" but the systems give me an error " Enter a fixed value".
    How I can include a blank option for an attribute dropdownlist????
    Thanks for your help.
    Best Regards.

    Hi,
    Can you let me know why would you need a blank attribute. What I want to know is that what business requirement is that going to serve.
    Regards,
    Deepak

  • XML/XSLT: Setting xsl:include href attribute with a variable

    I have a main layout stylesheet and depending on which page the user selects I want to use xsl:include to display the selected information in the 'content' DIV. The process works fine if hardcode it like this:
    <xsl:include href="welcome.xsl"/>
    <div id="content"
    <xsl:call-template name="welcome"/>
    </div>
    but, what I would like to do is have the name of the included template pulled from the xml file depending on which page was selected by the user. Something similar to this:
    <xsl:variable name="ss">
    <xsl:text><xsl:value-of select="root/stylesheet"/></xsl:text>
    </xsl:variable>
    <xsl:include href="{$ss}.xsl"/>
    <div id="content">
    <xsl:apply-template name="{$ss}"/>
    </div>
    So far I have tried using many different forms of code and have been unable to get this to work. Any ideas?
    EDIT: Okay, I have it partly figured out, at least why it isn't working. As far as I can tell, the 'xsl:include' tag must be a child of the 'xsl:stylesheet' tag, and is thus declared before the <xsl:template match="/"> which means it can't read the xml element to even store it in the variable. I have an idea of how to accomplish what I need, though.
    Last edited by munkyeetr (2009-01-28 03:29:58)

    I have attempted the same thing before as well. The only way I was able to dynamically build the xsl:include was to declare a new namespace e.g xmlns:out="output.xsl" in my XSL file and do something like the following:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:out="output.xsl">
    <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
    <xsl:varible name="xxx" select=" 'myFile.xsl' "/>
    <xsl:template match="/">
    <out:stylesheet version="1.0">
    <out:template match="/">
    <out:include>
    <xsl:attribute name="href">
    <xsl:value-of select="$xxx" />
    </xsl:attribute>
    </out:include>
    </out:template>
    </out:stylesheet>
    </xsl:template>
    </xsl:stylesheet>
    When applied to any valid XML document this produces the XSL file you are after as the output.
    To use this output against your intended XML source consider the following: A Java program can very quickly apply the above stylesheet to any XML source to get the output you want... then apply that XSL result to the actual XML document you are wanting to transform. From here you can do what you want with the transformed result.

  • Including sku attributes in product-sku-output-config.xml

    Hello,
    We have configured the product catalog integration between ATG and Endeca successfully and now I'm guessing how to expand/include other attributes of SKU into the Endeca Index, such as thumbnail and large Images which we are using as External Media Elements. I bet we'll have to customize product-sku-output-config.xml file, but how may this be accomplished?
    Any tip or direction?
    Thank you very much,
    Rogerio Biondi
    Discover Technology
    Edited by: monotone on Dec 11, 2012 12:28 PM

    Hi, monotone!
    Yesterday I faced with this issue too and resolved it in such way.
    1. Create product-sku-output-config.xml file in config folder of your module: config/atg/endeca/index/commerce/product-sku-output-config.xml
    2. Extend it by adding needed properties. If property value is primitive type, you may just add property:
    >
    <item item-descriptor-name="product">
         <properties>
              <property name="displayName" output-name="product.displayName" type="string" />
         </properties>
    </item>
    >
    If property value is Object, you must create property accessor that use custom logic for determining the values of properties that you specify. For example, the value of mediumImage is RepositoryItem of Media type. If you want to get medium image url (mediumImage.url), you may write so property accessor:
    >
    public class MediumImagePropertyAccessor extends PropertyAccessorImpl {
         private String mediumImagePropertyName = "mediumImage";
         private String urlPropertyName = "url";
         protected Object getTextOrMetaPropertyValue(Context pContext, RepositoryItem pItem, String pPropertyName, PropertyTypeEnum pType) {
              RepositoryItem externalMediaItem = (RepositoryItem) pItem.getPropertyValue(mediumImagePropertyName);
              String imageUrl = externalMediaItem.getPropertyValue(urlPropertyName).toString();
              return imageUrl;
    >
    After that you must specify this accessor in property-accessor attribute of your property in product-sku-output-config.xml:
    >
    <item item-descriptor-name="product">
         <properties>
              <property name="mediumImage" output-name="product.mediumImage"
                   type="string" property-accessor="/com/something/endeca/index/accessor/MediumImagePropertyAccessor" />
         </properties>
    </item>
    >
    3. Do baseline index via ProductCatalogSimpleIndexingAdmin component.
    Refer to http://docs.oracle.com/cd/E35318_02/Platform.10-1-1/ATGEndecaIntegrationGuide/html/s0401configuringendecaindexingoutputc01.html for more information.

  • Is Adobe Bridge included in Photoshop or Photoshop Elements?

    Is Adobe Bridge included in Photoshop or Photoshop Elements?

    Bridge is a assets manager for the Creative Suite and Creative Cloud which includes Photoshop,but not Photoshop Elements. It's bundled with CS applications,but with CC, it's a separate download.
    Gene

  • I own PS Elements 11 on CDs but recently purchased an new computer without a CD drive.  Can I transfer PS Elements to my new computer and, if so, how?  Is my only option to purchase and download PS Elements 13?

    I own PS Elements 11 on CDs but recently purchased an new computer without a CD drive.  Can I transfer PS Elements to my new computer and, if so, how?  Is my only option to purchase and download PS Elements 13?

    You can download and install PSE11 from the link below. Validate with the serial number from your CD packaging. It has 24 digits commencing 1057
    http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-10-11-downloads.html

  • XML attributes instead of elements in data contract serialisation in Rest WCF implementation

    I want to uses XML attributes instead of elements, I implemented IXmlSerializable and
    public partial class Id : IXmlSerializable {
    /// <remarks/>
    [XmlAttribute]
    public string lmsId;
    /// <remarks/>
    [XmlAttribute]
    public string unitId;
    /// <remarks/>
    [XmlAttribute]
    public string lmsPresId;
    /// <remarks/>
    [XmlAttribute]
    public string callId;
    public System.Xml.Schema.XmlSchema GetSchema()
    return null;
    public void ReadXml(System.Xml.XmlReader reader)
    //implement if remote callers are going to pass your object in
    public void WriteXml(System.Xml.XmlWriter writer)
    writer.WriteAttributeString("lmsId", lmsId.ToString());
    writer.WriteAttributeString("unitId", unitId.ToString());
    writer.WriteAttributeString("lmsPresId", lmsPresId.ToString());
    writer.WriteAttributeString("callId", callId.ToString());
    But my service help is showing request and response as unknown
    I tried even XmlSerializerFormat public partial class Id : IXmlSerializable {
    /// <remarks/>
    [XmlAttribute]
    public string lmsId;
    /// <remarks/>
    [XmlAttribute]
    public string unitId;
    /// <remarks/>
    [XmlAttribute]
    public string lmsPresId;
    /// <remarks/>
    [XmlAttribute]
    public string callId;
    public System.Xml.Schema.XmlSchema GetSchema()
    return null;
    public void ReadXml(System.Xml.XmlReader reader)
    //implement if remote callers are going to pass your object in
    public void WriteXml(System.Xml.XmlWriter writer)
    writer.WriteAttributeString("lmsId", lmsId.ToString());
    writer.WriteAttributeString("unitId", unitId.ToString());
    writer.WriteAttributeString("lmsPresId", lmsPresId.ToString());
    writer.WriteAttributeString("callId", callId.ToString());
    then I am getting everything in the xml as xmlElements instead of XmlAttributes But I am getting all the data as elements instead of Xmlattributes

    I will test it.
    I sale myself ONLY half CNY!

  • File name from an attribute of an element of the payload

    Dear Experts,
    Could you suggest the syntax for specifying the file name from a variable in the file receiver communication channel? I need to grab the file name from an ATTRIBUTE of an element of the payload.
    Thanks a lot.
    Example: Need to pass the attribute "descReceipt" of the element "promotionEvent" to the variable in the following payload:
    <?xml version="1.0" encoding="UTF-8"?>
    <promotionExport>
    <promotionEvent eventIdentifier="30" status="A" descReceipt="FILE1">

    The scenario is IDOC to FILE. I need to get the value of the receiving partner.
    The message header has the node "DynamicConfiguration". Please see the xml below. I need to grab the key RCVPRN (0000002104) from this and pass as the file name in the receiver file adapter.
    How do I setup my receiver file adapter for this? I tried changing the values for the variable, and also enabling the adapter specific message attributes. No solution yet.
    <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPOR">LXDCLNT250</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRT">LS</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRN">0000002104</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPOR">SAPLCD</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRN">LCDCLNT220</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="CIMTYP" />
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="IDOCTYP">WPDBBY01</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="MESTYP">WPDBBY</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRT">KU</SAP:Record>
      </SAP:DynamicConfiguration>

  • How to include a Attribute in a Navigation Block of a Web Report

    Hi all,
    I am trying to include an Attribute of an Infoobject in to a Navigation block. But the attribute is not appears in the list of navigation block objects inside the properties window of Web item (navigation block).
    And one more thing how can we find a 25dizit number of a info object
    Thank you
    srini

    Hi Fasttrack2,
    According to your description, there is a main report with more than 100 rows of summary information, when users click the item of the row, the report need to jump to detail information shows as graph. The problem you are facing is that you are not sure
    subreport, drilldown or drillthrough report should be used? You hope to set display detail information in the main report and keep high performance of report.
    In Reporting Services, each subreport instance is a separate query execution and a separate report processing task. Subreports are recommended when there are just a few subreport instances. We should not use subreports inside a group when there are many
    group instances, instead, consider using drillthrough reports. Drilldown reports process all data even when the data is first hidden. In order to improve the performance of the report, we can split drilldown reports into parameterized drillthrough reports,
    because Drillthrough reports do not run until a user clicks the drillthrough link in the main report.
    In this case, we can consider using drilldown or drillthrough report. In drilldown report, when we click a plus or minus button to expand or collapse a section of a report, the detail data will be displayed in place. By using drillthrough report, when we
    click the link in the main report, the detail data will be displayed, we can come back to the main report by click return button in the drillthrough report.
    Reference:
    Troubleshooting Reports: Report Performance
    Drillthrough, Drilldown, Subreports, and Nested Data Regions
    If you have any more questions, please feel free to ask.
    Best Regards,
    Wendy Fu
    If you have any feedback on our support, please click
    here.

  • Schema Validation on attributes of an element in XML againt XSD schema

    Hi,
    I had generated artifact java classes from XSD schema file.Now i am validatiing one sample XML document by using these classes in JAXB.The XML document is validated successfully.but only elements are validated ,but not attributes of that elements.for example ,i am giving wrong element which is not defined inside the schema file,it throws validation error as expected ,whereas validation against wrong attributes of elements in XML it is not working anyway,it does not throw any validation errors,but it should throw validation errors.kindly help me to solve this issue.
    Here The sample validation code snippets :
    import javax.xml.bind.ValidationEvent;
    import javax.xml.bind.ValidationEventHandler;
    import javax.xml.bind.ValidationEventLocator;
    public class MyEventHandler implements ValidationEventHandler{
         public boolean handleEvent(ValidationEvent ve) {
              if (ve.getSeverity()==ValidationEvent.FATAL_ERROR ||
                        ve .getSeverity()==ValidationEvent.ERROR){
                   ValidationEventLocator locator = ve.getLocator();
                   //Print message from valdation event
                   System.out.println("Invalid booking document: "
                             + locator.getURL());
                   System.out.println("Error: " + ve.getMessage());
                   //Output line and column number
                   System.out.println("Error at column " +
                             locator.getColumnNumber() +
                             ", line "
                             + locator.getLineNumber());
              return true;
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    unmarshaller.setEventHandler(new MyEventHandler());

    Here is my analagous 'strange' behavior. I am jaxb processing and then marshalling generated classes to XML ( following the simple Sun 'PurchaseOrder' example )
    1. This works:
    <xsd:schema....>
    <xsd:complextType name = "myName">
    <xsd:attribute name='name1'>
    </xsd:complextType>
    </xsd:schema>
    2. This doesn't:
    <xsd:schema....>
    <xsd:complextType name = "myName">
    <xsd:attribute name='name1'/>
    <xsd:attribute name='name2'/>
    </xsd:complextType>
    </xsd:schema>
    That is, using more than one attribute line within this simple complex type causes nothing to be marshalled to XML.
    Ideas?

  • Can't create detail VO  in one VO that including all attributes from M/D VO

    Hi,
    I have two EOs(BrFixreq/DafDefect) and two VOs(BrFixreqVO/DafDefectVO) based on the EOs, when create association between them I have selected "composition association" check box and "Cascade Update key Attributes" check box, and cardinality is 1 to 1.
    And also another VO( TestViewObj) includes all attributes in BrFixreqVO and DafDefectVO, and set BrFixreq/DafDefect to updatable in TestViewObj definition , and add TestViewObj to an AM(AppModue).
    When I run this AM in Oracle Business Component Browser, click "TestViewObj1" in left tab, and click the green plus sign on the toolbar, it only creates master VO attributes, not including detail VO attributes.
    Any directions will be great help to me!
    Thanks,
    zeroxin

    Hi,
    I presume that your tables are associated "1 to 1".
    This means that you could create your VO's and a viewLink and drop them in the page as Master(form)-Detail(form).
    You would have to bind actions for both VO's in each CRUD button (ex. Insert should execute CreateInsertMaster and CreateInsertDetails).
    Off course it would be better if things worked with a single VO because you would not have to do anything.
    This is simply proposed as a workaround in case that you cannot make it work. More issues regarding the details of your implementation could occur that you would have to deal with.
    Another way to handle this so that you have a single VO would be to create a database view that will handle insert, update, delete on both tables and create an Entity Object based on this view.
    You can read more about this in the Fusion Developer's Guide For Oracle ADF (Chapter 37.5)
    Gabriel.

  • How to change general attribute of text element

    hi
    who now how to change general attribute of text element on screen dinamically? I wish to change text value dinamically for example.

    Hi Denis,
    I am not too sure on what you want.
    If you require that the text value be different based on some conditions you can declare as many text elements as conditions and call the relevant text element.
    But I dont think that you can assign dynamic texts to a single text element.
    Regards,
    Saurabh

  • How to insert multiple attributes to root elements

    Hi,
    I have to costruct a request to a service in which all the multipul ements shold be populated as attributes.
    The elements should be retrived from response from an intermediate service callout.
    Is there any function to do that..

    Try this. Be careful that your element does not go deeper than 1 desendant or else you will get concatenating data.
    for $mydoc in $root
    return element { node-name($mydoc) } (: element constructor notation :)
    { $mydoc/@*, (:add existing attributes :)
         for $el in $mydoc/* (: element constructor sub-nodes :)
    return attribute {local-name($el)}{data($el)}
    I used http://www.xqueryfunctions.com/xq/functx_add-attributes.html as a guide.

Maybe you are looking for