My current url is: mysite.com/datasheet/100-DE-xmas2016-6
in web.config:
<rule name="myrule">
<match url="^datasheet/([_0-9a-z-]+)-([_0-9a-z-]+)-([_0-9a-z-]+)" />
<action type="Rewrite" url="ajax/datasheet.aspx?shop={R:1}&language={R:2}&product={R:3}" />
</rule>
it will not rewrites to
mysite.com/ajax/datasheet.aspx?shop_id=100&language=DE&product=xmas2016-6
Why???
How to make possible product "xmas2016-6" to work?
The list "mysite.com/datasheet/100-DE-xmas20166" will work. But I really want to use product as "xmas2016-6" (in regular expression set to [_0-9a-z-], but its like ignoring my "-" symbol in product parameter or what?)
This rule will work for you:
<rule name="myrule">
<match url="^datasheet/([_0-9a-z]+)\-([_0-9A-Z]+)\-([_a-z]+[0-9]{4})([0-9]{1})$" />
<action type="Rewrite" url="/ajax/datasheet.aspx?shop={R:1}&language={R:2}&product={R:3}-{R:4}" />
</rule>
Regexp ^datasheet/([_0-9a-z]+)\-([_0-9A-Z]+)\-([_a-z]+[0-9]{4})([0-9]{1})$ is splitting datasheet/100-DE-xmas20166 into four groups:
{R:0} datasheet/100-DE-xmas20166
{R:1} 100
{R:2} DE
{R:3} xmas2016
{R:4} 6
Related
I need help finding the overlapping dates in this XML code. I need to make sure that the End date is not less than or equal to the proceeding Start Date.
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-18" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="9" />
</InvCounts>
</Inventory>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-19" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="8" />
</InvCounts>
</Inventory>
I have tried the following code.
<rule context="Inventory">
<report test="translate(StatusApplicationControl/#Start, '-', '') <= translate(preceding::Inventory/preceding::StatusApplicationControl/#End, '-', '')">The #Start="<value-of select="#Start"/>" and #End="<value-of select="#End"/>" dates are overlaping</report>
</rule>
I expect this message to be printed -
The Start="2019-07-18" is less than or equal to the End="2019-07-18" date
Any help is greatly appreciated!
It looks like the comments are not helping you.
The rule should be:
<rule context="Inventory">
<report
test="translate(StatusApplicationControl/#Start, '-', '')
<=translate(preceding::Inventory[1]/StatusApplicationControl/#End,'-','')"
>The #Start="<value-of select="#Start"/>" and #End="<value-of
select="preceding::Inventory[1]/StatusApplicationControl/#End"
/>" dates are overlaping</report>
</rule>
EDIT
This Schematron
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern>
<title>Test dates</title>
<rule context="Inventory">
<assert
test="translate(StatusApplicationControl/#Start, '-', '')
> translate(preceding::Inventory[1]/StatusApplicationControl/#End,'-','')"
>The #Start="<value-of
select="StatusApplicationControl/#Start"
/>" and #End="<value-of
select="preceding::Inventory[1]/StatusApplicationControl/#End"
/>" dates are overlaping</assert>
</rule>
</pattern>
</schema>
With this input:
<root>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-18" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="9" />
</InvCounts>
</Inventory>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-19" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="8" />
</InvCounts>
</Inventory>
</root>
Output:
Pattern 'Test dates' Failed : The #Start="2019-07-18" and #End="2019-07-18" dates are overlaping.
Check in https://www.liquid-technologies.com/online-schematron-validator
Here is the SchemaTron rule that worked for me. The issue was passing preceding:: to the translate() function. When doing that I got a SchemaTron Exception.
<rule context="Inventory/StatusApplicationControl">
<report test="translate(#Start, '-', '') <= preceding::StatusApplicationControl/translate(#End, '-', '') ">The #Start="<value-of select="#Start"/>" and #End="<value-of select="#End"/>" dates are overlaping</report>
</rule>
Is there a way to verify that the template contains only those characters that are passed to #param ?
I considered options with xpath functions(fn:) but have not found a suitable option.
this is 2 valid xml for example:
<rule type="myRule" template="A-B-CB">
<attribute param="B"/>
<attribute param="A"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="A(C)-B">
<attribute param="C"/>
<attribute param="A"/>
<attribute param="B"/>
</rule>
and 2 not valid xml:
<rule type="myRule" template="AB-CD">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="AC">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
perhaps there are ideas how to implement it using schematrone or otherwise?
So the set of letters in #template must be exactly the same as the set of letters in ./attribute/#param?
That is to say, distinct-values(string-to-codepoints(replace(#template, '\P{L}', ''))) must be the same set as distinct-values(attribute/#param/string-to-codepoints()).
So how do you assert that two sequences contain the same values, under permutation?
In XPath 3.1, deep-equal(sort($X), sort($Y))
In XPath 2.0, I can't think of anything better than
empty($X[not(.=$Y)]) and empty($Y[not(.=$X)])
I'll leave you to put this all together.
I would like to connect two internal numbers with one, I mean if I call 499 then two phones should ring for example 123, 127.
My .xml files in directory/default looks like this:
<include>
<user id="127" mailbox="127">
<params>
<param name="password" value="xxxx"/>
<param name="vm-password" value="127"/>
</params>
<variables>
<variable name="toll_allow" value="domestic,international,local"/>
<variable name="accountcode" value="127"/>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="Extension 127"/>
<variable name="effective_caller_id_number" value="127"/>
<variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
<variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
<variable name="callgroup" value="techsupport"/>
</variables>
similar for 123 and 499 numbers.
How can I change it to make two phones rings(123,127) when someone calls 499?
in your dialplan you should call the bridge application like this.
<extension name="Local_Extension">
<condition field="destination_number" expression="^(1001)$">
<action application="bridge" data="sofia/internal/1001%${server-domain-name},sofia/internal/1002%${server-domain-name},sofia/internal/1003%${server domain-name}"/>
</condition>
</extension>
So if you call to 1001 then it will ring to 1001,1002,1003
I have the following xml and for the life of me cannot get preceding-sibling or following-sibling to work. I've tried these with no luck.
I would like to get the sibling just before the Category element that has name attribute that equals "sporting". So it would be the Group element i want. None of these work:
Transaction/Animals/Dog/Boxers/Boxer/Category[#name='sporting']/preceding-sibling::
Transaction/Animals/Dog/Boxers/Boxer/Category[#name='sporting']/preceding-sibling::[1]
Transaction/Animals/Dog/Boxers/Boxer/Category[#name='sporting']/preceding-sibling::Group
Cant even get previous boxer....none of these work.
Transaction/Animals/Dog/Boxers/Boxer[#name='Butch']/preceding-sibling::
Transaction/Animals/Dog/Boxers/Boxer[#name='Butch']/preceding-sibling::Boxer
Transaction/Animals/Dog/Boxers/Boxer[#name='Butch']/preceding-sibling::[1]
Transaction/Animals/Dog/Boxers/Boxer[#name='Butch']/preceding-sibling::[*]
--thanks
<Transaction>
<Animals>
<Dog>
<Boxers>
<Boxer id="46436">
<Transaction source="kennel"/>
<Category name="local"/>
</Boxer>
<Boxer name="Spike">
<Group id="456"/>
<Category name="sporting"/>
</Boxer>
</Boxers>
</Dog>
<Dog>
<Location Storee="pet store"/>
<Boxers>
<Boxer id="345739">
<Submission Source="store"/>
<Category name="local"/>
</Boxer>
<Boxer name="Butch">
<Group id="123"/>
<Category name="sporting"/>
</Boxer>
</Boxers>
<Additional>
<EffectiveDate>2015-03-01</EffectiveDate>
<ExpirationDate>2016-03-01</ExpirationDate>
</Additional>
</Dog>
</Animals>
</Transaction>
Well, figured out that moxy doesn't do axis. Which is ridiculous.
EclipseLink MOXy #XmlPath support for axes/parent
How can I move the terms and conditions from the last checkout step to the first one ?
I have tried only with the xml files, but I can't continue to the next step in this case.
Please help to do that.
In checkout.xml, move
<block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>
from <checkout_onepage_review> handle into <checkout_onepage_index>:
You have to modify
<block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/billing.phtml"/>
into
<block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/billing.phtml"></block>
and put the line inside.
In info.phtml (or review.phtml for v1.4.2) cut
<?php echo $this->getChildHtml('agreements') ?>
and paste that line you've just cut into billing.phtml.
Long time done this post but those that are still in need:
To add to that contributed from #OSdave - as #Bizboss is saying the terms and conditions checkbox doesn't have to be checked to proceed to the next step. To provide a front end solution with least fuss just add required-entry to the class name - e.g.
<input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->htmlEscape($_a->getCheckboxText()) ?>" class="checkbox required-entry" />
This employs JS validation to prevent it from proceeding to the next stage without being checked.